Created
January 28, 2016 08:16
-
-
Save humanium/22a6e0c6381ee228988b to your computer and use it in GitHub Desktop.
TestNG test changing method name in report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.experimental.b; | |
import org.testng.ITest; | |
import org.testng.annotations.*; | |
import org.testng.xml.XmlTest; | |
@Listeners({SomeTestListener.class}) | |
public class SomeFactoryTest implements ITest{ | |
private int id; | |
private String name = "unknown"; | |
private int intValue; | |
private String stringValue; | |
@Factory(dataProvider = "provider") | |
public SomeFactoryTest(int id, String name, int intValue, String stringValue){ | |
this.id = id; | |
this.name = name; | |
this.intValue = intValue; | |
this.stringValue = stringValue; | |
} | |
@DataProvider(name = "provider") | |
public static Object[][] getData(){ | |
return new Object[][]{ | |
{1, "firstTestName", 10, "first"}, | |
{2, "secondTestName", 20, "second"}, | |
{3, "thirdTestName", 30, "third"}, | |
}; | |
} | |
@Test | |
public void test(){ | |
System.out.println(String.format("%s : %s : %s", id, intValue, stringValue)); | |
} | |
@BeforeMethod | |
public void before(XmlTest test){ | |
test.setName(name); | |
} | |
@Override | |
public String getTestName() { | |
return name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment