5

I can use Arquillian TestRunner JUnit Container to write sequential tests.

import org.jboss.arquillian.junit.InSequence;
import org.jboss.arquillian.junit.Arquillian;

@RunWith(Arquillian.class)
public class ClassToTest{

    @Test
    @InSequence(1)
    public void test1() {
    // test something (1)
    }

    @Test
    @InSequence(2)
    public void test2() {
    // test something (2)
    }
}

It is possible to do same thing using Arquillian TestRunner TestNG Container? If so how can I do that.

lorezzer
  • 63
  • 3

1 Answers1

1

Yes. You can do the sequencing of test methods by dependency chaining in TestNG.

it would be like the below

@Test
public void test1() {
// test something (1)
}

@Test(dependsOnMethods = { "test1" })
public void test2() {
// test something (2)
}

Please refer the below for more info

http://www.tutorialspoint.com/testng/testng_dependency_test.htm

sathya_dev
  • 513
  • 3
  • 15
  • This works fine for unit tests. I need to run integration tests sequentially in Arquillian TestRunner TestNG Container (org.jboss.arquillian.testng.Arquillian) – lorezzer May 12 '15 at 07:25
  • @lorezzer I've used the same for running in container tests integration tests for testing EJBs. Are you having any specific errors? Then specify clearly – sathya_dev May 12 '15 at 08:45
  • Or if you want to specify this dependency chaining at the test group level you can do the same in TextNG.xml file – sathya_dev May 12 '15 at 08:48
  • I checked your solution and that`s working fine. I was wondering if Arquillian TestRunner TestNG Container offers similar annotation like @InSequence(1) – lorezzer May 13 '15 at 06:52