Over a year later, the Google-internal usage of TestParameterInjector has continued to rapidly grow, and is now by far the most popular parameterized test framework.
As you can see on the graph above, not only did TestParameterInjector reduce the usage of the other frameworks, but it also caused a drastic increase of the total amount of parameterized tests. This suggests that TestParameterInjector reduced the threshold for parameterizing a regular unit test and Googlers are more actively using this tool to improve the quality of their tests.
JUnit5 (Jupiter) support
At Google, we use JUnit4 exclusively, but some developers outside of Google have moved on to JUnit5 (Jupiter). For those users, we have now expanded the scope of TestParameterInjector.We've kept the API the same as much as possible:
The other features of TestParameterInjector work in a similar way with Jupiter:
Other things we've been working on
Custom names for @TestParametersWhen running the following parameterized test:
For those cases, we added the option to add customName:
It should be noted that the original API (list of YAML strings in single annotation) still works, but it is now discouraged in favor of multiple @TestParameters annotations with a single YAML string, even when customName isn't used. The main arguments for this recommendation are:
- Consistency with the customName case, which needs a single YAML string per @TestParameters annotation
- We believe it structures the list of parameters (especially when it's long) in a more structured way
Integration with RobolectricTestRunner
Recently, we've managed to internally make a version of RobolectricTestRunner that supports TestParameterInjector annotations. There is a significant amount of work left to open source this, and we are now considering when and how to do this.Learn more
Our GitHub README provides an overview of the framework. Let us know on GitHub if you have any questions, comments, or feature requests!By Jens Nyman – TestParameterInjector