jeudi 24 novembre 2016

Surefire rerun failing tests not working

I want to rerun a test that I know will fail cause I am trying to test the surefire parameter for rerunning the failing tests. I tried running maven with these two commands neither of them works as expected

-Dsurefire.rerunFailingTestsCount=2 -Dtest=TestThatFails test

and

-Dsurefire.rerunFailingTestsCount=2 -Dtest=TestThatFails surefire:test

Here is part of pom.xml

<dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-api</artifactId>
            <version>2.19.1</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.1</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
    </dependency>

I was expecting that the surefire will restart the test after failure but maven just throws this error, which I know how to solve but I want the test to be rerun.

Results :

Tests in error: 
  testA(selenium.services.TestThatWillFail): Element is not currently visible and so may not be interacted with(..)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 55.060 s
[INFO] Finished at: 2016-11-24T12:58:02+01:00
[INFO] Final Memory: 18M/173M

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project eskn_selenium: There are test failures.

Aucun commentaire:

Enregistrer un commentaire