With @RunWith( Suite.class )
I can group test classes into a test suite and run them all together. With @RunWith( Parameterized.class )
I can run the same test for different parameters. What I want is to run a test suite for different parameters. Is there a way of doing that?
JUnit 5, the next generation of JUnit, facilitates writing developer tests with shiny new features. One such feature is parameterized tests. This feature enables us to execute a single test method multiple times with different parameters.
The parameterized test class also meets the following requirements: It is annotated with @RunWith(Parameterized. class). It has a single constructor that contains the test data. It has a static method which annotated with @parameters annotation and generates and returns test data.
I always recommend that people switch to TestNG, which is just like JUnit 4, except with more functionality.
It has built-in support for parameterization and grouping.
I suspect what you're trying to do will be easy with TestNG - JUnit does not have the 'grouping' capability that TestNG does.
http://testng.org/doc/migrating.html
http://www.mkyong.com/unittest/testng-parameter-testing-example/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With