简体   繁体   中英

Run robolectric tests in order?

I've got Robolectric test suite for my app.

As I understand, by-default Robolectric runs tests in alphabetical order.

I have tests

testA()
testB()

This tests need to run in reverse order, eg testB() changes tested activity state to whatever testA() needs.

How do I specify order in which tests must be ran?

Renaming tests by-hand is no good.

It's not recommend to use fixed test order but you could try to use @FixMethodOrder(MethodSorters.NAME_ASCENDING) at your test classes.

See also the discussion here How to run test methods in specific order in JUnit4?

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