Java JUnit5动态测试
我犯了这个错误Java JUnit5动态测试,java,junit5,Java,Junit5,我犯了这个错误 XQTest.lambda$null$0:51 » NoClassDefFound Could not initialize class weblogic.... java.lang.NoClassDefFoundError: Could not initialize class weblogic.xml.query.parsers.StAXFactoryHelper 这是我的测试: @TestFactory public Stream<DynamicTest> X
XQTest.lambda$null$0:51 » NoClassDefFound Could not initialize class weblogic....
java.lang.NoClassDefFoundError: Could not initialize class weblogic.xml.query.parsers.StAXFactoryHelper
这是我的测试:
@TestFactory
public Stream<DynamicTest> XQueryDynamicTestsFromStream() throws IOException {
ArrayList<Tuple4> tuple4 = buildTest.buildTestFromResources();
System.out.println("TEST");
return tuple4.stream()
.map(phrs ->
DynamicTest.dynamicTest(
"Test XQuery: (" + phrs.a.substring(phrs.a.lastIndexOf("\\") + 1) + ")"
, () -> {
int idx = tuple4.indexOf(phrs);
String transformer = tuple4.get(idx).a;
String testPath = tuple4.get(idx).b;
String inpFile = tuple4.get(idx).c;
String expFile = tuple4.get(idx).d;
XQueryTester tester = new XQueryTester(transformer, testPath);
if (inpFile.contains("HDR")) {
assertTrue(tester.testHeader(inpFile, expFile));
} else if (inpFile.contains("PAY")) {
causing error->assertTrue(tester.testBody(inpFile, expFile));
}
}
)
);
}
@TestFactory
公共流XQueryDynamicTestsFromStream()引发IOException{
ArrayList tuple4=buildTest.buildTestFromResources();
系统输出打印(“测试”);
返回tuple4.stream()
.map(phrs->
动态测试,动态测试(
测试XQuery:(“+phrs.a.substring(phrs.a.lastIndexOf(“\\”)+1)+”
, () -> {
int idx=tuple4.indexOf(phrs);
字符串转换器=tuple4.get(idx).a;
字符串testPath=tuple4.get(idx.b);
字符串inpFile=tuple4.get(idx.c);
字符串expFile=tuple4.get(idx.d);
XQueryTester=新的XQueryTester(变压器、测试路径);
if(inpFile.contains(“HDR”)){
assertTrue(tester.testHeader(inpFile,expFile));
}else if(inpFile.contains(“PAY”)){
导致错误->assertTrue(tester.testBody(inpFile,expFile));
}
}
)
);
}
仅供参考:我正在测试XQuery,因此编写了自己的引擎XQueryTester
,我将其实例化为“tester”
根据我使用
XQueryTest(buildTest)
搜索的文件,我正在运行一个头或负载测试。看起来像是包含weblogic.xml.query.parsers.statxFactoryHelper的JAR在测试运行时不在类路径上。如果是这样的话,这与JUnit无关。看起来包含weblogic.xml.query.parsers.StatxFactoryHelper
的JAR在测试运行时不在类路径上。如果是这样,这与JUnit无关。