Rakesh Kumar
Rakesh Kumar

Reputation: 43

TestNG Report- Publishing tests in an Order

TestNG Report - Publishing tests in an Order.

How to show test in the executed order in TestNG custom report. Right now my executed tests are published randomly in TestNG report. I am using the below custom Listener code from this URL.

The TestNG XML is:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Main Suite" parallel="false">
  <listeners>
    <listener class-name="com.dev2qa.example.testng.report.custom.CustomTestNGReporter"/>
  </listeners>
  <test name="CHApp Android Automation" preserve-order="true" enabled="true">
    <classes>
      <class name="com.ch.chapp.CHAppAndroidTestSuite.TestSet1">
        <methods>
          <include name="exe_Scheduler"/>
          <include name="chApp_SignIn"/>
          <include name="chApp_VerifyUserRecogInApp"/>
          <include name="chApp_HeaderMenu"/>
          <include name="chApp_HamburgerMenu"/>
          <include name="chApp_DailyPrize"/>
        </methods>
      </class>
      <class name="com.ch.chapp.CHAppAndroidTestSuite.TestSet3">
        <methods>
          <include name="c1_SuperPrizeSweep1"/>
          <include name="c1_SuperPrizeSweep1_Complete"/>
          <include name="c1_Mission1Sweep2"/>
        </methods>
      </class>
      <class name="com.ch.chapp.CHAppAndroidTestSuite.TestSet2">
        <methods>
          <include name="c1_Mission1Sweep2_Complete"/>
          <include name="chApp_VerifyVIPInApp"/>
          <include name="chApp_SignOut"/>
        </methods>
      </class>
    </classes>
  </test>
</suite>

Upvotes: 2

Views: 905

Answers (1)

Ishita Shah
Ishita Shah

Reputation: 4035

  • Extent Report always manage Test order as according to what you have created for it.
  • There is no need to manage method name in your TestNG.XML, You should remove it. Try to create simple structure. Then implement it for your project. You should implement multiple Test without using Selenium reference, You can test it.

    Reference1 : http://extentreports.com/docs/versions/3/java/#basic-usage
    Reference2 : https://github.com/ishah09/ExtentReport-3.1.5

  • You are managing inappropriately that is causing you. I found something, ExtentManager.getExtent(); that is something different from actual usage.

So I suggest you to go through with above mentioned references and implement it.

Upvotes: 1

Related Questions