在我的报告中,excel 表中的最后一个测试名称被附加到我的结果中。这是我的代码
public class Test_suite implements ITest {
private String testInstanceName="";
public String getTestName()
{
return testInstanceName;
}
private void setTestName(String anInstanceName)
{
this.testInstanceName = anInstanceName;
}
@DataProvider()
public Object[][] Unit() throws Exception
{
Object[][] testObjArray = Excel.getTableArray("./Test Data/Test.xlsx","Unit");
return (testObjArray);
}
@BeforeMethod(alwaysRun=true)
public void before(Method method,Object[] parameters)
{
String testCaseId="";
testCaseId = parameters[0].toString();
System.out.println(testCaseId);
setTestName(testCaseId);
}
@Test(dataProvider="Unit")
public void Test(){
}
我的报告看起来像这样