Search code examples
mavencommand-lineautomated-teststestngsurefire

"Skipping execution of surefire because it has already been run for this configuration"?


Please excuse the newb question - my conceptual models are still quite incomplete...

I'm trying to re-execute TestNG tests from a command line using maven and surefire. My command line looks like:

D:\workspaces\workspace01\aptest>mvn clean install surefire:test -Dtests=myTestNGSuite test

Clearly I'm not getting it because the output I end up with includes:

[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ aptest ---
[INFO] Skipping execution of surefire because it has already been run for this configuration

How do I clear out the configuration so I can re-run my TestNG suite from the command line? Is there a better way to run TestNG suites from the command line?

TIA, -->Aaron


Solution

  • The test goal of the surefire plugin is automatically run in the test phase so the first time just run

     mvn clean install -Dtest=MyTestNGTest
    

    and then if you want to re run do a

    mvn install -Dtest=MyTestNGTest
    

    Note that I am not calling the clean goal so that only your changes of test cases or code are recompiled and that I am NOT invoking the test goal of the surefire plugin.