I know this can be done for junit reports generated by testng by extending JUnitReportReporter and overriding getTestName method.
But can this be done for TestNG reports? I really want this feature so that testcases having dataprovider can be displayed with some custom name e.g
methodname_filename for testng reports
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/lfiUoJB7FRAJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Have your test class extend org.testng.ITest and override getTestName().
--Cédric
On Fri, Aug 10, 2012 at 5:49 AM, Arun Panda <[hidden email]> wrote:
I know this can be done for junit reports generated by testng by extending JUnitReportReporter and overriding getTestName method.
But can this be done for TestNG reports? I really want this feature so that testcases having dataprovider can be displayed with some custom name e.g
methodname_filename for testng reports
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/lfiUoJB7FRAJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
If you reply to this email, your message will be added to the discussion below:http://testng.1065351.n5.nabble.com/Is-it-possible-to-display-custom-methods-name-in-TestNG-reports-tp16315p16317.html
Hi,
I am also facing a similar issue.
I need to overwrite the testcase name when i use Dataprovider for passing test data. Currently all tests show the same name in the report. I tried implementing ITest but don't know how i can overwrite the getTestName() method so that i can get different testcase name for each of the dataset. Can some one give me sample code with end to end integration.
Is there a way where i pass my own test case name in the dataprovider as an argument which will be shown in the report.(This way i will get different name for each dataset)
Thanks,
Neeraja.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/AxtxtDWf9o0J.
public class NewTest implements ITest {
String dataname = null;
@DataProvider(name="BasicDataProvider")
public Object[][] getTestData() {
Object[][] data = new Object[][] {
{ new TestParameters("TestCase1", "Sample test 1")},
{ new TestParameters("TestCase2", "Sample test 2")},
{ new TestParameters("TestCase3", "Sample test 3")},
{ new TestParameters("TestCase4", "Sample test 4")},
{ new TestParameters("TestCase5", "Sample test 5") }
};
return data;
}
public NewTest() {}
@Factory(dataProvider = "BasicDataProvider")
public NewTest(TestParameters testParams) {
String testCase = "";
String classname;
if (testParams != null) {
testCase = testParams.getTestName();
}
// dataname = String.format("%s(%s)", cake);
Class<?> enclosingClass = getClass().getEnclosingClass();
if (enclosingClass != null) {
classname = enclosingClass.getName();
} else {
classname = getClass().getName();
}
dataname = classname + " " + testCase;
// System.out.println(">>>>>>><<<<<<<<<<<<<<"+dataname);
System.out.println("factory");
}
@Test(dataProvider="BasicDataProvider")
public void testSample1(TestParameters testParams){
System.out.println("The test is run");
//test code here
}
@Test(dataProvider="BasicDataProvider")
public void testSample2(TestParameters testParams){
//test code here
}
@Override
public String getTestName()
{
return dataname;
}
}
It now just gets testsample 1 to 5. It would be unique if it can get the test method name along with it which would make it unique.
Thanks
KV.
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
-positiveProfileEditTest_1
-positiveProfileEditTest_2
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.