• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package test.priority;
2 
3 import org.testng.Assert;
4 import org.testng.TestNG;
5 import org.testng.annotations.Test;
6 import org.testng.xml.XmlSuite;
7 
8 import test.SimpleBaseTest;
9 
10 public class PriorityTest extends SimpleBaseTest {
11 
runTest(Class<?> cls, String first, String second, boolean parallel)12   private void runTest(Class<?> cls, String first, String second, boolean parallel) {
13     TestNG tng = create(cls);
14     if (parallel) tng.setParallel(XmlSuite.ParallelMode.METHODS);
15     tng.run();
16     Assert.assertEquals(BaseSample.m_methods.get(0), first);
17     Assert.assertEquals(BaseSample.m_methods.get(1), second);
18   }
19 
20   @Test(enabled = false, description = "Make sure priorities work in parallel mode")
priorityInParallel1()21   public void priorityInParallel1() {
22     runTest(WithPrioritySampleTest.class, "first", "second", true /* parallel */);
23   }
24 
25   @Test(enabled = false, description = "Make sure priorities work in parallel mode")
priorityInParallel2()26   public void priorityInParallel2() {
27     runTest(WithPrioritySample2Test.class, "second", "first", true /* parallel */);
28   }
29 
30   @Test(description = "Make sure priorities work in sequential mode")
priorityInSequential1()31   public void priorityInSequential1() {
32     runTest(WithPrioritySampleTest.class, "first", "second", false /* sequential */);
33   }
34 
35   @Test(description = "Make sure priorities work in sequential mode")
priorityInSequential2()36   public void priorityInSequential2() {
37     runTest(WithPrioritySample2Test.class, "second", "first", false /* sequential */);
38   }
39 }
40