Search code examples
seleniumjunittestng

Selenium: what difference between JUnit and testNG to parallel the tests?


I am discovering selenium and more precisely selenium grid which allows the creation of nodes and the execution of parallel tests on several browsers.

I was wondering what the difference is between these 2 frameworks: is there one that performs better than the other? Thanks


Solution

  • As per Cédric Beust's TestNG Documentation:

    TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use, such as:

    • Annotations.
    • Run your tests in arbitrarily big thread pools with various policies available (all methods in their own thread, one thread per test class, etc).
    • Test that your code is multithread safe.
    • Flexible test configuration.
    • Support for data-driven testing (with @DataProvider).
    • Support for parameters.
    • Powerful execution model (no more TestSuite).
    • Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
    • Embeds BeanShell for further flexibility.
    • Default JDK functions for runtime and logging (no dependencies).
    • Dependent methods for application server testing.

    TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration.