我更新了我的空手道1.3.0版本。RC2到1.3.1。然后我在运行器文件中运行了测试,但我得到了一个错误。在更新之前,它工作正常。
BaseTest.java
package features;
import com.intuit.karate.junit5.Karate;
import java.util.*;
public class BaseTest {
@Karate.Test
Karate Money() {
return Karate.run("Money").relativeTo(getClass());
}
}
错误:
org.junit.platform.commons.JUnitException: @TestFactory method [com.intuit.karate.junit5.Karate features.BaseTest.Money()]
must return a single org.junit.jupiter.api.DynamicNode or a Stream, Collection, Iterable, Iterator, or array of
org.junit.jupiter.api.DynamicNode.at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.invalidReturnTypeException(TestFactoryTestDescriptor.java:133)
at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.lambda$invokeTestMethod$1(TestFactoryTestDescriptor.java:110)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.invokeTestMethod(TestFactoryTestDescriptor.java:93)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)`
我没有找到任何解决办法。这是bug还是特性?
我知道你们刚刚更新了空手道核心版本。此外,如果你更新了空手道junit5版本,你的问题就解决了。
<dependencies>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>