Jacobvu84 / selenium-vietnam-training-course

Questions Tracking
7 stars 5 forks source link

Serenity tagging using JUnit #61

Open Jacobvu84 opened 5 years ago

Jacobvu84 commented 5 years ago

Running test with tags

@RunWith(SerenityRunner.class)
@Narrative(text = {"As User, I would like to .. so that I should..."})
@WithTags({
        @WithTag("color:red")
})
public class CompleteAnOrangeTodo {
    @Test
    @WithTag("color:yellow")
    public void should_be_able_to_complete_a_todo() {}

    @Test
    @WithTag("color:blue")
    public void should_see_the_number_of_todos_decrease_when_an_item_is_completed() {}
}

All of these tests have the tag “color:red”. So if you wanted to run all of the red tests, you would use:

$ mvn clean verify -Dtags="color:red"

The third test contains the tag “color:blue”, at a method level. If you wanted to run only the blue test, you would do this:

$ mvn clean verify -Dtags="color:blue"

Jacob Vu khóa học Selenium WebDriver online cho cá nhân