Open caofanCPU opened 1 year ago
经过排查,发现testable.properties配置文件不生效 我是使用spock测试框架
配置文件不生效怎么排查呢
再排查,发现可能是环境上哪里有问题,导致testable-agent无法直接识别出test/resource下的testable.properties配置文件,使用pom指定相对于根路径的path,可以成功
使用的是spock框架,开启了增强omni.constructor.enhance.enable=true 测试用例里使用spock的Mock方法时,会出现报错:构造方法重复
Duplicate method name "
请问spock对于spock的搭配,具体实践还是new 实际类麽?
附上场景代码
`class OmniConstructorTest extends Specification {
@SpringBean
private SomeServiceClass contractClient = Mock()
@MockDiagnose(LogLevel.VERBOSE)
static class Mock {
}
@Unroll
def "omniConstructor"() {
def bigDecimal = OmniConstructor.newInstance(BigDecimal.class)
def date = OmniConstructor.newInstance(Date.class)
def longNumber = OmniConstructor.newInstance(Long.class)
def bigInt = OmniConstructor.newInstance(BigInteger.class)
expect:
assert 0 == OmniConstructor.newInstance(int.class)
assert 0L == OmniConstructor.newInstance(Long.class)
assert "" == OmniConstructor.newInstance(String.class)
assert LogLevel.DISABLE == OmniConstructor.newInstance(LogLevel.class)
assert 0.0 == bigDecimal
assert date.getTime() > 0
assert longNumber == 0L
assert bigInt.intValue() == 0
}
}`
JDK jdk1.8.0_291.jdk
IDEA版本: IntelliJ IDEA 2022.3.1 (Ultimate Edition) Build #IU-223.8214.52, built on December 20, 2022