Mikhail Krutov
Mikhail Krutov

Reputation: 702

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, e.g. 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.

Upvotes: 3

Views: 1751

Answers (1)

nenick
nenick

Reputation: 7438

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?

Upvotes: 2

Related Questions