Skip to content
Marcel Pfotenhauer edited this page Oct 8, 2020 · 23 revisions

Neodymium provides an extended JUnit4 test runner. The NeodymiumRunner is used to provide our features like test data handling, multi browser support and the consequential test multiplication.

Usage

The NeodymiumRunner can be used easily by annotating the test case class. Please see example below:

@RunWith(NeodymiumRunner.class)
public class DemoTest
{
    @Test
    public void ensureFunctionality()
    {
        // add test code
    }
}

Supported Annotations

Neodymium provides a set of annotations that can be used to configure a test case using the NeodymiumRunner.

Multi Browser

  • @Browser
  • @SuppressBrowser

Please check the Multi browser support page for detailed information.

Test data

  • @DataSet
  • @SuppressDataSet
  • @DataFile

Please check the Test data provider page for detailed information.

Test Execution order

In general the standard test execution order of JUnit > 4.11 applies. More info here https://github.com/junit-team/junit4/wiki/Test-execution-order. This means in default there is no fixed order within the methods annotated with @Test since they are retrieved as map.

For Neodymium this results in a mixture of ordered and unordered. The test methods are retrieved as map but while computing the test multiplication for test data sets and browsers they are added as a complete sets (cross product of method, test data sets and browsers) for each method that is effected by Neodymium's annotations(see above).

In addition it's possible to fix the method order by using JUnit's @FixMethodOrder annotation. Please see example below:

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@RunWith(NeodymiumRunner.class)
public class DemoTest
{
    @Test
    public void ensureFunctionalityC()
    {
        System.out.println("third");
        // add test code
    }

    @Test
    public void ensureFunctionalityB()
    {
        System.out.println("second");
        // add test code
    }

    @Test
    public void ensureFunctionalityA()
    {
        System.out.println("first");
        // add test code
    }
}
Clone this wiki locally