简体   繁体   中英

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?

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

From JUnit: A Cook's Tour TestSuite作为JUnit的组合:库克之旅

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM