Search code examples
javaseleniumjenkinssurefire

How to configure Jenkins to run 1 selenium test case


I am running Jenkins on Windows 7 as service.

I have approximately 100 selenium test cases in package, but I want to run only 1 test case.

Is it possible to configure Jenkins to run not all, but 1 test?


Solution

  • Depending on how your Jenkins build is configured, somewhere you are specifying the maven goals. These can be configured to specify the test you want to execute, as described here:

    mvn -Dtest=TestCircle#mytest test

    Note that this require surefire 2.7.3 or later, and Junit 4.X or TestNG:

    As of Surefire 2.7.3, you can also run only a subset of the tests in a test class.

    NOTE: This feature is supported only for Junit 4.x and TestNG.

    For older versions of the Surefire plugin/JUnit, it seems it is only possible to control this on class level, i.e. you cannot specify a specific test in a class:

    mvn -Dtest=TestCircle test