4

I have some packages

com.company.testing.module1
com.company.testing.module2
com.company.testing.module3

I also have some classes that have TestNG annotations in

com.company.testing.tests

Now I put testng.xml in

com.company.testing

The XML file looks like

<?xml version="1.0" encoding="UTF-8"?>
<suite name="Foo">
    <test name="Bar">
        <package>
            <package name="com.company.testing.tests" />
        </package>
    </test>
</suite>

How do I run the suite from Eclipse? What Run Configuration should I do?

3 Answers 3

11

Install the TestNG plug-in and when you're done, you can just right click on your XML file and "Run as/Debug as... TestNG.

Sign up to request clarification or add additional context in comments.

4 Comments

I didn't realize the XML can be run directly. I ran it and got Total tests run: 0, Failures: 0, Skips: 0 result. Seems like no test was executed. I suspect there is some classpath config that needs to be done. Am I correct? P.S. I am so surprised that the author of TestNG is answering me!
I get the same problem, 0 tests run. I am trying to run the same setup from the DOS command prompt in Windows 7. Did anybody figure this out?
use this in your testng.xml and replace the values as per your tests <!DOCTYPE suite SYSTEM "testng.org/testng-1.0.dtd" > <suite name="testng1" verbose="1" > <test name="alltests"> <packages> <package name="com.sk176h.testng.simple"></package> </packages> </test> </suite>
worked for me like a charm! but as I'm taking as a base maven test project, I've just added appropriate dependecy.
1

You'll need the testng plugin. Then its just a matter of running the testng task. See the docs for further details.

Comments

0

To run your test through testNG.xml goto the class file right click and select Run as >>run configuratins. Select Suite and browse your testNG.xml (default in eclipse - testng-customsuite.xml) and RUN.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.