宁静测试未与Serenity Parameterized Runner一起运行

时间:2020-09-25 10:19:48

标签: java junit parameters automated-tests serenity-bdd

我正在尝试使用参数化的跑步者进行宁静测试,

@RunWith(SerenityParameterizedRunner.class)
public class CloneViewTest {
   
    String val;
    public CloneViewTest(String testData) {
        val = testData;
    }

    protected Actor james = Actor.named("James");
    @Managed
    protected WebDriver driver;

    @Before
    public void jamesCanBrowseTheWeb() {
        james.can(BrowseTheWeb.with(driver));
    }

    @TestData
    public Collection<Object[]> testdata() {
        return Arrays.asList(new Object[][]{
                {"cats"},
                {"dogs"},
                {"ferrets"},
                {"rabbits"},
                {"canaries"}
        });
        
    }

    @Test
    public void should_be_able_to_clone_views() {
        james.attemptsTo(Open.browserOn().the(Column_dictionaryPage.class));

    }
}

问题是无论何时使用mvn clean verify运行此测试,测试都成功,但是没有运行测试。日志还显示了跳过测试

[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ -Automation ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ -Automation ---
[INFO] Building jar: C:\Users\Hamza Y\IdeaProjects\-Assignment-Serenity-Screenplay\target\-Automation-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M5:integration-test (default) @ -Automation ---
[INFO]
[INFO] --- serenity-maven-plugin:2.3.4:aggregate (serenity-reports) @ -Automation ---
[INFO] Test results for 0 tests generated in 1.7 secs in directory: file:/C:/Users/Hamza%20Y/IdeaProjects/-Assignment-Serenity-Screenplay/target/site/serenity
/
[INFO] -----------------------------------------
[INFO]  SERENITY TESTS : SUCCESS
[INFO] -----------------------------------------
[INFO] | Tests executed         | 0
[INFO] | Tests passed           | 0
[INFO] | Tests failed           | 0
[INFO] | Tests with errors      | 0
[INFO] | Tests compromised      | 0
[INFO] | Tests pending          | 0
[INFO] | Tests ignored/skipped  | 0
[INFO] ------------------------ | --------------
[INFO] | Total Duration         | 000ms
[INFO] | Fastest test took      | 000ms
[INFO] | Slowest test took      | 000ms
[INFO] -----------------------------------------

也如日志中所示,没有执行,失败或跳过测试。这可能是什么问题?

1 个答案:

答案 0 :(得分:2)

您很可能使用了错误的类名。假设您使用的是默认配置,则verify将使用类似*IT.java的模式运行测试 https://maven.apache.org/surefire/maven-failsafe-plugin/examples/inclusion-exclusion.html

将您的课程重命名为CloneViewTestIT,然后重试。