Sven
Sven

Reputation: 1133

Collecting all tests in one class JUnit

I'd like to use a Request object because of sorting and filtering options.

Problem is that if you construct the Request based upon multiple test classes, at execution it shows that it sorts all the tests only in the test classes, instead of all the tests of all the test classes. So tests are only sorted relative to the class they came from.

I'm thinking of perhaps manually collecting all tests, putting it in one class and making a Request based upon that class. Is that possible? If not what are other options to solve my problem?

Upvotes: 0

Views: 66

Answers (2)

Sven
Sven

Reputation: 1133

Thanks for the suggestion but that isn't what I need. Bad explanation on my part.

Request object is required. TestSuites doesn't work.

Solution is creating a request per test and storing it in a list and sorting the list.

Upvotes: 0

Elliott Frisch
Elliott Frisch

Reputation: 201537

I believe you want a TestSuite. You'd use it to create a Composite (e.g. to in-turn invoke each test it composes).

From JUnit: A Cook's Tour TestSuite as a Composite from JUnit: A Cook's Tour

Upvotes: 1

Related Questions