Choosing between JUnit and TestNG

In most cases, a typical java project relies upon one single unit testing framework, JUnit or TestNG. UISpec4J is configured to automatically detect the underlying testing framework, and redirect the assertion checks to their "low level" counterparts.

For instance, the code snippet textBox.textEquals("OK") translates to:

  • junit.framework.Assert.assertEquals("OK", actualContent) for JUnit
  • org.testng.Assert.assertEquals(actualContent, "OK") for TestNG

Occasionally, for example temporarily during a migration or a library appraisal, the project classpath might contain references to both JUnit and TestNG libraries. UISpec4J then requires you specify your preferred dependency by setting the 'uispec4j.test.library' property to one among [junit, testng].