宁静 Java 谓词失败
Serenity Java predicate failed
我正在使用 Java 11.0.11 在 ScreenPlay 模式中通过 Serenity+Cucumber+Gherkin 开发一些自动化测试
已经完成了十几个步骤定义目前没有错误但是这个:
//SomeStepDefinitions.java:
String bar = "my String";
105: theActorInTheSpotlight().should(
seeThat(
theActorInTheSpotlight -> XPATH_TARGET1.resolveFor(theActorInTheSpotlight).getText()
, equalTo(bar)
)
);
任意抛出
TEST FAILED
17:04:45.023 [Test worker] DEBUG - RELATED ISSUES:
17:04:45.087 [Test worker] ERROR - Test failed at step: Then do something step definitions$$ lambda6/0x00000001006ce840 should be Predicates.equalTo(my String)
17:04:45.087 [Test worker] ERROR - predicate failed
predicate failed
java.lang.AssertionError: predicate failed
at net.serenitybdd.screenplay.ErrorTally.throwSummaryExceptionFrom(ErrorTally.java:38)
at net.serenitybdd.screenplay.ErrorTally.reportAnyErrors(ErrorTally.java:32)
at net.serenitybdd.screenplay.Actor.should(Actor.java:322)
at stepdefinitions.Folder1.Folder2.SomeStepDefinitions.Foo(SomeStepDefinitions.java:105)
有什么想法吗?
遇到这个问题的人,已经绕过了这个问题:
theActorInTheSpotlight().attemptsTo(
Ensure.that(FOO.value().answeredBy(theActorInTheSpotlight())).isEqualTo(bar)
);
class FOO extends WebDriverQuestion implements Question<String> {
@Override
public String answeredBy(Actor actor) {
return Text.of(XPATH_TARGET1).viewedBy(actor).asString();
}
public static FOO value(){
return new FOO();
}
}
我还想知道为什么初始代码随机失败。
我正在使用 Java 11.0.11 在 ScreenPlay 模式中通过 Serenity+Cucumber+Gherkin 开发一些自动化测试
已经完成了十几个步骤定义目前没有错误但是这个:
//SomeStepDefinitions.java:
String bar = "my String";
105: theActorInTheSpotlight().should(
seeThat(
theActorInTheSpotlight -> XPATH_TARGET1.resolveFor(theActorInTheSpotlight).getText()
, equalTo(bar)
)
);
任意抛出
TEST FAILED
17:04:45.023 [Test worker] DEBUG - RELATED ISSUES:
17:04:45.087 [Test worker] ERROR - Test failed at step: Then do something step definitions$$ lambda6/0x00000001006ce840 should be Predicates.equalTo(my String)
17:04:45.087 [Test worker] ERROR - predicate failed
predicate failed
java.lang.AssertionError: predicate failed
at net.serenitybdd.screenplay.ErrorTally.throwSummaryExceptionFrom(ErrorTally.java:38)
at net.serenitybdd.screenplay.ErrorTally.reportAnyErrors(ErrorTally.java:32)
at net.serenitybdd.screenplay.Actor.should(Actor.java:322)
at stepdefinitions.Folder1.Folder2.SomeStepDefinitions.Foo(SomeStepDefinitions.java:105)
有什么想法吗?
遇到这个问题的人,已经绕过了这个问题:
theActorInTheSpotlight().attemptsTo(
Ensure.that(FOO.value().answeredBy(theActorInTheSpotlight())).isEqualTo(bar)
);
class FOO extends WebDriverQuestion implements Question<String> {
@Override
public String answeredBy(Actor actor) {
return Text.of(XPATH_TARGET1).viewedBy(actor).asString();
}
public static FOO value(){
return new FOO();
}
}
我还想知道为什么初始代码随机失败。