You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ITestResult.getTestClass().getXmlTest().getIndex() should return valid test indexes when a TestNG class is invoked from YAML test suite.
Actual behavior
ITestResult.getTestClass().getXmlTest().getIndex() always returns 0.
When the same test class is invoked from an XML suite, the XmlTest.getIndex() returns expected values.
Is the issue reproducible on runner?
Shell
Maven
Gradle
Ant
Eclipse
IntelliJ
NetBeans
Test case sample
To reproduce run the following class:
public class TestNGTest {
@Parameters("input")
@Test
public void testSomething(String input) throws Exception {
// doSomething
}
@AfterMethod
public void afterMethod(ITestResult result) {
XmlTest xmlTest = result.getTestClass().getXmlTest();
System.out.println("afterMethod test=" + xmlTest.getName() + ", index=" + xmlTest.getIndex());
}
}
Presumably the following code section in the parse method of org.testng.internal.Yaml should be setting the XmlTest indexes:
// Adjust XmlTest parents and indices
for (XmlTest t : result.getTests()) {
t.setSuite(result);
int index = 0;
for (XmlClass c : t.getClasses()) {
c.setIndex(index++);
}
}
The text was updated successfully, but these errors were encountered:
TestNG Version
Expected behavior
ITestResult.getTestClass().getXmlTest().getIndex() should return valid test indexes when a TestNG class is invoked from YAML test suite.
Actual behavior
ITestResult.getTestClass().getXmlTest().getIndex() always returns 0.
When the same test class is invoked from an XML suite, the XmlTest.getIndex() returns expected values.
Is the issue reproducible on runner?
Test case sample
To reproduce run the following class:
with the YAML test descriptor:
observe console output with '0' test indexes:
Run the same class with an equivalent XML test descriptor:
observe console output with correct test indexes:
Presumably the following code section in the
parse
method oforg.testng.internal.Yaml
should be setting the XmlTest indexes:The text was updated successfully, but these errors were encountered: