Axos
Axos

Reputation: 81

Creating a TestNG suite via testng.xml to run in Eclipse (Windows)

I'm somewhat new to automation. I don't know any programming languages officially, but have been able to make-do through research and determination. As a consequence, however, my terminology is poor, so forgive me if I'm not making myself clear :D

I've successfully written dozens of Selenium test scripts in java, but this .xml format is new territory and I can't seem to find any decent documentation for noobs like me.

Here's my issue:

I'm currently deploying my Selenium (RC) TestNG test classes via Eclipse. I understand that I have to write my own custom testng.xml file to deploy suites. That said, I'm confused by the context of this file. It seems pretty straightforward, but I can't seem to get it to execute any of the classes that I toss in here.

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

<suite name="Suite" verbose="1" >
  <test name="NameofMyTest" >
      <classes>
       <class name="O13TestNG" />
       <class name="U13PITestNg2" />
  </classes>
  </test>
</suite>

These classes that I'm calling are in a different package, however. Do they have to be in the same package when running it as a TestNG suite via the testng.xml? When running as a JUnit suite, I simply import the classes inside the suite class and run it as a Junit Test in Ecplipse, but it seems that all the fancy reports that TestNG provides does not come with JUnit. Or does it? If so, how / where do I find it?

Upvotes: 1

Views: 3528

Answers (1)

JacekM
JacekM

Reputation: 4099

You should probably specify package name together with the class. For instance:

<class name="com.company.project.YourTest" />

As for reporting: TestNG reporting abilities are known to be superior to JUnit. TestNG is also richer in functionality, so I would definitely stick to it.

Upvotes: 1

Related Questions