testng-team / testng-googlecode

DEPRECATED: Automatically exported from code.google.com/p/testng
0 stars 0 forks source link

Testng results has incorrect failure/pass/total count with retry #104

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Simple project with 2 tests, configured to use retry. One test is written to 
always pass and another test is written to always fail
2. Have a myRetryAnalyzer which extends from RetryAnalyzerCount...Set retry 
count to say 7
3. Run the tests

What is the expected output? What do you see instead?
Expected out : Total : 2, Pass: 1, Fail : 1

Actually seeing : Total: 9, Pass: 1, Fail: 8

What version of the product are you using? On what operating system?
Latest version of testng - 6.4 ...Mac and Windows 7

Please provide any additional information below.

Here is sample code

Test file
package testng;

import org.testng.Assert;
import org.testng.annotations.Test;

public class RetryTest {

    @Test(retryAnalyzer=MyRetry.class, groups={"retry"})
     public void test1() {
       Assert.assertTrue(true); 
     } 

     @Test(retryAnalyzer=MyRetry.class, groups={"retry"})
     public void test2() { 
         Assert.assertTrue(false); 
     }

}

Retry class

package testng;

import org.testng.ITestResult;
import org.testng.util.RetryAnalyzerCount;

public class MyRetry extends  RetryAnalyzerCount { 

        public MyRetry(){ 

                setCount(7); 
        } 

        @Override 
        public boolean retryMethod(ITestResult arg0) { 
                // TODO Auto-generated method stub 
                return true; 
        } 

} 

Testng-results -- Note the total, passed and failed count

<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="8" total="9" passed="1">
  <reporter-output>
  </reporter-output>
  <suite name="Default Suite" duration-ms="117" started-at="2012-03-06T14:05:13Z" finished-at="2012-03-06T14:05:13Z">
    <groups>
      <group name="retry">
        <method signature="testng.RetryTest.test1()" name="test1" class="testng.RetryTest"/>
        <method signature="testng.RetryTest.test2()" name="test2" class="testng.RetryTest"/>
      </group>
......

Can anyone please address this issue? We have tried 5.8, 5.11, 5.12 and then 
6.4 now ....looks like the issue has been there since long time

Original issue reported on code.google.com by ksweth...@gmail.com on 7 Mar 2012 at 12:25

GoogleCodeExporter commented 9 years ago
take a look at this place ,this is the known issue:
http://stackoverflow.com/questions/7803691/how-to-optimize-testng-and-seleniums-
tests

Original comment by alterhu2...@gmail.com on 21 Feb 2014 at 9:33