1
votes

I am using an IntelliJ ULTIMATE 14 in a MAC and I would like to develop a Selenium Test with TestNG. My Java class runs well. But when I create the test.xml file, IntelliJ does not recognize this. This means, when I click with right Button on the test.xml file I have not the Option to RUN the Test with the test.xml file.

I've been in Run/Debug Configurations and I've set up a new RUN Option:

  1. + TestNG
  2. Name: LoginTest
  3. Suite Option selected
  4. Suite: /PATH/PROJECT/src/test/resources/test.xml
  5. In single Module: /PATH/PROJECT/src/test/resources/test.xml
  6. JDK Settings / VM option: -ea

Below this window I get the following ERROR message:

Run Configuration Error: Unable to parse
`/PATH/PROJECT/src/test/resources/test.xml`

I have used too the Maven Dependency:

<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.8</version> </dependency>

Please someone has a tip?

UPDATE-01:

when I run though XML file I get the following message:

org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 24; System-ID muss mit einem einzelnen oder doppelten Anführungszeichen beginnen.

at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:340)

at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)

at ...

Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 24; System-ID muss mit einem einzelnen oder doppelten Anführungszeichen beginnen.

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)

at ...

Process finished with exit code 0

UPDATE-02

The test.xml content is:

<?xml version="1.0" encoding="UTF-8"?>

<suite name="Login Tests">

<test name="P1 Test">
    <groups>
        <run>
            <include name="p1" />
        </run>
    </groups>
    <classes>
        <class name="com.facebook.tests.Login_Test"/>
    </classes>
</test>

<test name="P2 Test">
    <groups>
        <run>
            <include name="p2" />
        </run>
    </groups>
    <classes>
        <class name="com.facebook.tests.Login_Test">
            <methods>
                <exclude name="filloutPassFld"/>
            </methods>
        </class>
    </classes>
</test>


</suite>
2
What error you getting when run though XML? - Helping Hands
Hi Helping Hands, please see my UPDATE-01. Thanks. - JEFA
Why you are using plugin IntelliJ? Any special purpose? - rahul bhatt
I would like run a Parallel Test with the Code in file from the UPDATE-02 above. - JEFA

2 Answers

0
votes

Please post the test.xml content. Obviously, SAXParser complains about it: System ID must begin with a single or double quotes.

0
votes

I found the problem. In test.xml file I forgot the quotes ("") in the command:

DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"

Thanks for listening.