index.html report should be in test execution order, currently its in alphabetical order

673 views
Skip to first unread message

Ahmed

unread,
Jan 30, 2015, 2:09:19 PM1/30/15
to testng...@googlegroups.com

Hi everyone,

I have written couple of methods and executed testSuite. TestSuite runs successfully but when i m seeing 'index.html', its showing success cases result in alphabetical order.

===================
Here is java code:
===================
package testng.order.execution.testCases;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.*;

public class DemoTestNG {
public WebDriver driver = new FirefoxDriver();

@Test
public void gmailLogin() {

driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");
element.submit();
System.out.println("Page title is: " + driver.getTitle());

}

@Test
public void amailLogin() {
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");
element.submit();
System.out.println("Page title is: " + driver.getTitle());
//driver.quit();
}

}



================
testng.xml code:
================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="HTML Test Execution Order" preserve-order="true" verbose="0" junit="false" parallel="false">

<listeners>
      <listener class-name="org.uncommons.reportng.HTMLReporter"/>
      <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
  </listeners>

<!--FireFox Browser Parameter -->
<test name="Firefox Test">
<parameter name="browser" value="firefox" />
<classes>
<class name="testng.order.execution.testCases.DemoTestNG">
<methods>
<include name="gmailLogin" />
<include name="amailLogin" />
</methods>
</class>
</classes>
</test>
</suite>


Then i checked 'index.html' in surefire-reports folder, its showing result alphabetical. I need html report in test execution order. Any idea if something is missing?

=====================
See index.html snapshot
=====================



As 'gmailLogin' was the first case executed but its showing 'amailLogin' as first case. I want to see html report in executed case order not alphabetically sorted order. Kindly suggest me if i m missing something.

Ahmed

unread,
Jan 31, 2015, 7:22:51 AM1/31/15
to testng...@googlegroups.com
My problem is the order of the RESULTS according to the order of execution, not the order of execution.

Krishnan Mahadevan

unread,
Feb 1, 2015, 8:13:31 AM2/1/15
to testng...@googlegroups.com
Looking at the code, I think this is the behaviour by default. Tests are being sorted by class name and then by method names before being displayed in the report.
If you need a different order, you would need to :

  1. Build your own reporter by implementing IReporter (or)
  2. By extending org.testng.reporters.EmailableReporter2

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Engr. Riaz Ahmed Memon

unread,
Feb 1, 2015, 8:54:35 AM2/1/15
to testng...@googlegroups.com
Krishnan Mahadevan,

Can you give me an example by a sample code?

Thanks

On Sun, Feb 1, 2015 at 6:13 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
Boxbe This message is eligible for Automatic Cleanup! (krishnan.ma...@gmail.com) Add cleanup rule | More info

Looking at the code, I think this is the behaviour by default. Tests are being sorted by class name and then by method names before being displayed in the report.
If you need a different order, you would need to :

  1. Build your own reporter by implementing IReporter (or)
  2. By extending org.testng.reporters.EmailableReporter2

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


From: Ahmed <engineer...@gmail.com>
Reply-To: <testng...@googlegroups.com>
Date: Saturday, 31 January 2015 5:52 pm
To: <testng...@googlegroups.com>
Subject: [testng-users] Re: index.html report should be in test execution order, currently its in alphabetical order

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/blTM57xxIRk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to testng-users...@googlegroups.com.

To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.




--
Kind Regards
Riaz Ahmed Memon

Krishnan Mahadevan

unread,
Feb 1, 2015, 9:00:18 AM2/1/15
to testng...@googlegroups.com


If you would like to create a new reporter, then start off by implementing the IReporter interface.
Take a look at this blog post of mine to understand how to work listeners in general

To understand how to go about altering the display order take a look at the actual implementation here 



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply all
Reply to author
Forward
0 new messages