1

I have a Spring Boot application which is capable of running Integration tests using Rest Assured.

There is a single test class which has multiple test cases. I wish to run the test cases serially as given in the class.

public class ItemControllerTest{
    @Before
    public void setUp(){
     ...
    }

    @Test
    public void test1(){
     ...
    }

    @Test
    public void test2(){
     ...
    }
}

When I run integration test,it seems test2 is getting executed before test1.

But I want them to run in the order they are written

Soumya
  • 1,833
  • 5
  • 34
  • 45
  • maybe http://stackoverflow.com/questions/3693626/how-to-run-test-methods-in-specific-order-in-junit4 – sodik May 06 '15 at 07:40

1 Answers1

0

I am not familiar with spring-boot, but if you are using Junit to run your tests, then you can run them serially by adding the following annotation above your class:

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ItemControllerTest{

// tests will run in order here

}
JamesWillett
  • 980
  • 2
  • 8
  • 20