My favorites | Sign in
Project Home
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 2: Number of methods is reported incorrectly in the TestNG View when a test method is run multiple times.
3 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


 
Reported by willismi...@gmail.com, Oct 26, 2006
To reproduce the problem, write a test with a data provider that causes the
test to be run multiple times.  Run the test, and look at the "Methods:
n/n" result shown in the TestNG View.  When done with the example code that
I will provide, the result is "Methods: 3/1".  This should either be
"Method: 1/1" or "Methods: 3/3", depending on whether it is reporting the
number of test methods, or the number of test method calls that are made.

Example.java:

public class Example {

	String value;
	
	public Example(String value) {
		this.value = value;
	}
	
	public String getValue() {
		return value;
	}
}

ExampleTest.java:

import static org.testng.Assert.assertEquals;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class ExampleTest {

    @DataProvider(name = "provider")
    public Object[][] provideValues() {
    	return new Object[][]{{"foo"}, {"42"}, {"bar"}};
    }
    
    @Test(groups = {"unit"}, dataProvider = "provider")
    public void testValue(String value) {
    	Example testObject = new Example(value);
    	assertEquals(value, testObject.getValue());
    }
}

testng_plugin_output.png
27.3 KB   Download
Oct 26, 2006
Project Member #1 the.mind...@gmail.com
Yep, this is the bug, and the correct output should be 3/3 (the number of test
methods invoked).

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

Owner: ---

Powered by Google Project Hosting