Given question 'How to run all tests belonging to a certain Category?' and the answer would the following approach be better for test organization?
Example:
My question is more like soliciting approval rate for such approach vs. classic test suite approach. One unbeatable benefit is that every new test is immediately contained by relevant suites with no suite maintenance. One concern is proper categorization of each test.
In JUnit, both @RunWith and @Suite annotations are used to run the suite tests.
A test case answers the question: What am I going to test? You develop test cases to define the things that you must validate to ensure that the system is working correctly and is built with a high level of quality. A test suite is a collection of test cases that are grouped for test execution purposes.
One of the trade-off you have to consider is IMHO that categories are defined within the tests and suites are defined outside. This means, that when you use suites, you know which tests will be run, but when using categories, you do not know unless you inspect tests or simple run them. At the same time, when you look at the test using test suites you do not know in which suite it is contained, unless checking your suites, but using categories, you see it immidiatly.
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