Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XmlTest does not copy the xmlClasses during clone #2467

Closed
aditya-qapitol opened this issue Jan 27, 2021 · 2 comments
Closed

XmlTest does not copy the xmlClasses during clone #2467

aditya-qapitol opened this issue Jan 27, 2021 · 2 comments

Comments

@aditya-qapitol
Copy link
Contributor

TestNG Version

7.3.0

Expected behavior

getXmlClasses()in XmlTest should not be null when xmlTest.Clone()

Actual behavior

getXmlClasses()in XmlTest is null when xmlTest.Clone() is called

Is the issue reproductible on runner?

  • Eclipse
  • IntelliJ

Test case sample

Sample TestNG XML File

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite verbose="1" name="TestSuite" annotations="JDK">
    <test name="Test1">
        <classes>
            <class name="com.qa.SampleTest"/>
        </classes>
    </test>
</suite>

The listener is added in the META-INF.services folder

public class TestNgAlterSuiteListener implements IAlterSuiteListener {
    @Override
    public void alter(List<XmlSuite> suites) {
      XmlSuite suite = suites.get(0);
      List<XmlTest> xmlTests = suite.getTests();
      XmlTest test = xmlTests.get(0);
      XmlTest newTest= (XmlTest) test.clone();
      System.out.println("Contains: " + newTest.getXmlClasses().toString())
    }
}
@juherr
Copy link
Member

juherr commented Jan 27, 2021

result.setXmlClasses(getXmlClasses()); is missing in the clone method.

Would you like the propose a fix?

aditya-qapitol added a commit to aditya-qapitol/testng that referenced this issue Jan 28, 2021
aditya-qapitol added a commit to aditya-qapitol/testng that referenced this issue Jan 28, 2021
aditya-qapitol added a commit to aditya-qapitol/testng that referenced this issue Jan 28, 2021
@aditya-qapitol
Copy link
Contributor Author

result.setXmlClasses(getXmlClasses()); is missing in the clone method.

Would you like the propose a fix?

Please check the PR for the fix

krmahadevan pushed a commit that referenced this issue Jan 28, 2021
* #2467

* #2467; test case for bug

* #2467; updated CHANGES.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants