This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 221819 - [73cat] Test Results for TestNG tests with @DataProvider do not include the actual parameters
Summary: [73cat] Test Results for TestNG tests with @DataProvider do not include the a...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: TestNG (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on: 223660
Blocks:
  Show dependency tree
 
Reported: 2012-11-09 13:18 UTC by misterm
Modified: 2013-05-06 09:29 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
result using 6.5.1 (55.77 KB, image/png)
2012-12-11 14:33 UTC, Theofanis Oikonomou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description misterm 2012-11-09 13:18:51 UTC
One of the main reasons of using @DataProvider is getting the parameters that caused a particular test to fail along with the failure message. Currently, NetBeans does not display them and it makes this feature useless if only some tests failed.

Product Version = NetBeans IDE Dev (Build 20121108-dd70d6fce533)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_01
Runtime = Java HotSpot(TM) 64-Bit Server VM 21.1-b02
Comment 1 Theofanis Oikonomou 2012-11-20 13:25:58 UTC
I am sorry but I cannot reproduce in NetBeans IDE Dev (Build 20121119-3e15ac13b3cf). In any case, passed/failed test method, the value passed to the method from the dataProvider is shown both in the output window and the tests results window.
Comment 2 misterm 2012-12-10 15:48:10 UTC
I am running:

import static org.testng.Assert.assertEquals;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class SampleTestCase {
	@DataProvider(name = "sample")
	Object[][] sample() {
		return new Object[][] {{4, 2}};
	}
	
	@Test(dataProvider = "sample")
	public void test_sample(int a, int b) {
		assertEquals(9, a * b);
	}
}

with TestNG 6.8 in a Maven project. All I get is:

Failed: expected:[8] but was:[9]

Values 4 and 2 should be shown in addition.
Comment 3 Theofanis Oikonomou 2012-12-11 14:09:03 UTC
6.8 is not yet fully supported
Comment 4 misterm 2012-12-11 14:12:15 UTC
This is also true for TestNG 6.1.1
Comment 5 Theofanis Oikonomou 2012-12-11 14:33:59 UTC
Created attachment 129208 [details]
result using 6.5.1

I am not sure about 6.1.1 but with 6.5.1 which is the version shipped with nb it works as expected for me, while using Test project or Test file actions.
Comment 6 misterm 2012-12-11 15:02:22 UTC
Are you testing this with Maven? With Maven, I cannot even use 6.5.1:

org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: java.lang.NullPointerException
	at org.testng.TestNG.createCommandLineSuitesForClasses(TestNG.java:572)
	at org.testng.TestNG.initializeCommandLineSuites(TestNG.java:806)
	at org.testng.TestNG.run(TestNG.java:1001)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:70)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:158)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:98)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
	... 9 more
Comment 7 Lukas Jungmann 2012-12-12 09:44:26 UTC
In Maven you have to use 6.5.2, version 6.5.1 is known to be broken there
Comment 8 misterm 2012-12-12 10:28:28 UTC
It does not work either.
Comment 9 Theofanis Oikonomou 2012-12-12 12:59:01 UTC
I can reproduce in maven with 6.5.2 version. 

If CoS is disabled Test project (1) and Test file (2) actions produce "...test_sample Failed:..."

If CoS is enabled Test project (3) action produces "...test_sample Failed:..." but Test file (4) action produces "...test_sample(4, 2) Failed:..."

Also only in case (4) the extra filtering buttons are shown in the Test Results Window and also testng related logs ([VerboseTestNG]...) in the output window. 

Milosi, any insight? Thank you
Comment 10 Theofanis Oikonomou 2013-05-06 09:29:55 UTC
I think this is an issue with surefire. No information about the parameters that a test method was invoked with are present in the report. See also http://jira.codehaus.org/browse/SUREFIRE-624. Closing this on nb side. Thank you