Parametrized JUnit tests with JUnitParams
Parameterized unit tests are used to to test the same code under different conditions. Thanks to parameterized unit tests we can set up a test method that retrieves data from some data source. This data source can be a collection of test data objects, external file or maybe even a database. The general idea is to make it easy to test different conditions with the same unit test method, which will limit the source code we need to write and makes the test code more robust. We can call these tests data-driven unit tests. The best way to achieve data-driven unit tests in JUnit is to use a JUnit's custom runner - Parameterized or JUnitParams' JUnitParamsRunner . Using JUnit's approach may work in many cases, but the latter seems to be more easy to use and more powerfull.