Skip to content

Issue2370: only priority 1 is executing across multiple classes when we execute Testng suite version 6.14.3

Bruce Wen edited this page Sep 26, 2020 · 2 revisions

This wiki page is to explain the Issue 2370. The issue is not produced with 6.14.3.

  • Test Classes:
  import org.testng.annotations.*;
  public class HomePage {                                                                                                                                                                
      @BeforeSuite
      public void login(){
          System.out.println("BeforeSuite: User Logged in");
      }

      @Test(priority=2)
      public void verifyLogoIsPresent(){
          System.out.println("P2: Logo");
      }

      @Test(priority=1)
      public void verifyEmailIsPresent(){
          System.out.println("P1: Email");
      }

      @Test(priority=3)
      public void verifyPasswordIsPresent(){
          System.out.println("P3: Passwor");
      }

      @Test(priority=4)
      public void averifySubmitIsPresent(){
          System.out.println("P4: Submit");
      }
  }
  import org.testng.annotations.*;
  public class Login{

      @Test(priority=2)
      public void verifyLogoIsPresent(){
          System.out.println("P2: LoginLogo");
      }

      @Test(priority=1)
      public void verifyEmailIsPresent(){
          System.out.println("P1: LoginEmail");
      }

      @Test(priority=5)
      public void verifyPasswordIsPresent(){
          System.out.println("P5: LoginPassword");

      }

      @Test(priority=6)
      public void verifySubmitIsPresent(){
          System.out.println("P6:LoginSubmit");

      }

      @AfterSuite
      public void logout(){
          System.out.println("AfterSuite: User Logged out");
      }

  }
  • Test Suite:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">                                                                                                                                   <suite name="Demo Test Suite.02">
  <test name="Demo Test 02-1">
	  <classes>
		  <class name="se.ericsson.training.testng.demo.test.HomePage"/>
	  </classes>
  </test>

  <test name="Demo Test 02-2">
	  <classes>
		  <class name="se.ericsson.training.testng.demo.test.Login"/>
	  </classes>
  </test>
</suite>
  • Test Result
<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="0" ignored="0" total="8" passed="8">
  <reporter-output>
  </reporter-output>
  <suite name="Demo Test Suite.02" duration-ms="101" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
    <groups>
    </groups>
    <test name="Demo Test 02-1" duration-ms="16" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
      <class name="se.ericsson.training.testng.demo.test.HomePage">
        <test-method status="PASS" signature="verifyEmailIsPresent()[pri:1, instance:se.ericsson.training.testng.demo.test.HomePage@2ac1fdc4]" name="verifyEmailIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method status="PASS" signature="verifyLogoIsPresent()[pri:2, instance:se.ericsson.training.testng.demo.test.HomePage@2ac1fdc4]" name="verifyLogoIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method status="PASS" signature="verifyPasswordIsPresent()[pri:3, instance:se.ericsson.training.testng.demo.test.HomePage@2ac1fdc4]" name="verifyPasswordIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method status="PASS" signature="averifySubmitIsPresent()[pri:4, instance:se.ericsson.training.testng.demo.test.HomePage@2ac1fdc4]" name="averifySubmitIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
      </class> 
    </test> 
    <test name="Demo Test 02-2" duration-ms="2" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
      <class name="se.ericsson.training.testng.demo.test.HomePage">
        <test-method status="PASS" signature="login()[pri:0, instance:se.ericsson.training.testng.demo.test.HomePage@2ac1fdc4]" name="login" is-config="true" duration-ms="10" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
      </class> 
      <class name="se.ericsson.training.testng.demo.test.Login">
        <test-method status="PASS" signature="verifyEmailIsPresent()[pri:1, instance:se.ericsson.training.testng.demo.test.Login@6fffcba5]" name="verifyEmailIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method status="PASS" signature="verifySubmitIsPresent()[pri:6, instance:se.ericsson.training.testng.demo.test.Login@6fffcba5]" name="verifySubmitIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method status="PASS" signature="verifyLogoIsPresent()[pri:2, instance:se.ericsson.training.testng.demo.test.Login@6fffcba5]" name="verifyLogoIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method status="PASS" signature="verifyPasswordIsPresent()[pri:5, instance:se.ericsson.training.testng.demo.test.Login@6fffcba5]" name="verifyPasswordIsPresent" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method status="PASS" signature="logout()[pri:0, instance:se.ericsson.training.testng.demo.test.Login@6fffcba5]" name="logout" is-config="true" duration-ms="0" started-at="2020-09-26T09:25:01Z" finished-at="2020-09-26T09:25:01Z">
          <reporter-output>
          </reporter-output>
        </test-method> 
      </class> 
    </test> 
  </suite> 
</testng-results>