Assertion and verification in the test case are checkpoints. Each checkpoints will be found in report. If it is UI test, it will automatically attach screenshot with each checkpoint message. You can refer documentation for Assertion/Verification.
EDIT:
Steps are also considered as Checkpoint. When there is a step call all checkpoints (step/assertion/verification) inside it will become sub checkpoint. Step is any java method annotated with @QAFTestStep
for example:
@QAFTestStep(description = "search for {term}")
public static void searchFor(String searchTerm) {
$("name=q").sendKeys("test");
$("searchpage.searchbtn.loc").click();
}
When step called it will be reported as checkpoint. Step can be called in test case or in feature file. Below is sample testcase in feature file:
Scenario: SampleTest
Given get '/'
When search for 'qaf github infostretch'
Then verify link with partial text 'qaf' is present
Below is sample test case in java
@Test
public void testGoogleSearch() {
get("/");
searchFor("qaf github infostretch");
$("partialLink=qaf").verifyPresent();
}
Regardless of test case in java or in bdd, report will be same.
Another way to create dynamic step in test written in java is using runtime is using runtime scenario factory.
public void testWithGivenWhenThen() {
scenario().
given("a precondition",()->{
//write appropriate code...
}).
when("some action performed",()->{
//write appropriate code...
}).
then("it should have expected outcome",()->{
//write appropriate code...
}).
execute();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句