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

Suite of suite-files has CloseChannelException #1201

Closed
1 of 7 tasks
james-crocker opened this issue Oct 14, 2016 · 4 comments
Closed
1 of 7 tasks

Suite of suite-files has CloseChannelException #1201

james-crocker opened this issue Oct 14, 2016 · 4 comments

Comments

@james-crocker
Copy link

james-crocker commented Oct 14, 2016

TestNG Version

6.9.13

Expected behavior

Successful read of a suite-file.

Actual behavior

Caused by: org.testng.TestNGException: java.nio.channels.ClosedChannelException
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:20)
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:9)
    at org.testng.xml.Parser.parse(Parser.java:170)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:279)
    at org.testng.TestNG.run(TestNG.java:1081)

Notes

Both files exist and readable. Running just tests.xml is successful. Running with individually enumerated suite xml eg. tests1.xml, tests2.xml executes successfully.

Encountered while using TestNG in a maven project and assigning the suite xml programmatically with testNg.setXmlSuites(List<XmlSuite>);

Also, built 6.9.13 (Ubuntu 16.04 x64). Successful build. Jar in testng/build/libs/testng-6.9.13.jar. However there is 'no main manifest attribute'; so couldn't just do java -jar testng-6.9.13.jar suite-files.xml.

Is the issue reproductible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

suite-files.xml

<?xml version="1.0" standalone="no"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" preserve-order="true">
  <suite-files>
    <suite-file path="/tmp/tests.xml"></suite-file>
  </suite-files>
</suite>

tests.xml

<?xml version="1.0" standalone="no"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="ParallelTests" preserve-order="true" parallel="tests">
  <test name="TestGoogle">
    <classes>
      <class name="com.sios.stc.coseng.tests.demo.Google">
        <methods>
          <include name="connect1" />
        </methods>
      </class>
    </classes>
  </test>
</suite>
@juherr
Copy link
Member

juherr commented Oct 15, 2016

However there is 'no main manifest attribute'; so couldn't just do java -jar testng-6.9.13.jar suite-files.xml.

Related to #1190

@juherr
Copy link
Member

juherr commented Oct 15, 2016

@james-crocker I'm not able to reproduce the issue. Could you share a full runnable sample?

My test was and work as expected (minus #863):

  @Test
  public void test() throws IOException, SAXException, ParserConfigurationException {
    TestNG tng = new TestNG();
    tng.setXmlSuites(new Parser("suite-files.xml").parseToList());
    tng.run();
  }

@james-crocker
Copy link
Author

Went back to create a simple example. In doing so, found that during some pre-processing I set the xmlSuite.setFileName() which in turn made it self-referential I think. At any rate, removed this step and all is good in reading a suite xml file with suite-files declarations. Thank you for time and consideration.

@juherr
Copy link
Member

juherr commented Oct 17, 2016

Ok. If you think something is wrong with setFileName, feel free to open another issue.

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