Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 硒化物&x2B;Junit 5 assertionMode=SOFT不';行不通_Java_Junit5_Selenide - Fatal编程技术网

Java 硒化物&x2B;Junit 5 assertionMode=SOFT不';行不通

Java 硒化物&x2B;Junit 5 assertionMode=SOFT不';行不通,java,junit5,selenide,Java,Junit5,Selenide,我的问题是,当我尝试设置Selenide变量assertionMode=SOFT时,我的测试被忽略,Selenide抛出异常: java.lang.IllegalStateException: Using soft asserts, but without @SoftAsserts annotation 例如,当我使用Selenide文档中的示例时: 在测试类上方编写注释 @ExtendWith(SoftAssertsExtension.class) class IssueCreationTe

我的问题是,当我尝试设置Selenide变量assertionMode=SOFT时,我的测试被忽略,Selenide抛出异常:

java.lang.IllegalStateException: Using soft asserts, but without @SoftAsserts annotation
例如,当我使用Selenide文档中的示例时:

在测试类上方编写注释

@ExtendWith(SoftAssertsExtension.class)
class IssueCreationTest extends BaseTest {

@Test
void test() {...}
}
或将SoftAssertsExtension定义为类变量

class Tests {

@RegisterExtension 
static SoftAssertsExtension softAsserts = new SoftAssertsExtension();

@Test
void test() {...}
}
我也有同样的问题


也许有人遇到了这个问题,也许有人知道我如何解决它?

好吧!当我用@BeforeAll和@afterall方法将BaseTest描述为某种逻辑和行为时,必须在测试开始之前完成,脚本在第一个方法上崩溃。。。单击()。。。在带有注释@BeforeAll和@afterall的方法中(下面的示例截图)

但是如果您将这些步骤转移到此类中带有@test注释的方法,或者转移到BaseTest将听到的类的方法。。。然后一切都开始工作,使用文档中描述的所有方法(下面的示例截图)

问题解决了,我希望我清楚地描述了本质。目前还不清楚为什么在第一个案例中,Sekenide拒绝工作并抛出异常