2

I am learning TestNG and working on parameterization. I created a new java class and then I created a new testng.xml file. I included the class name in the xml file. But I tried to run the testNG.xml file as TestNG Suite nothing will work.

Please see to the java class,

 public class Test1 { @Test public void test_Firefox() { System.out.println("Test_Firefox method.."); } } 

Testng.xml file,

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Suite1" verbose="1" > <test name="Test" > <classes> <class name="com.multibrowser.Test1" /> </classes> </test> </suite> 

Folder structure, enter image description here

Please help me in this.

1
  • did you get this working ? Commented Aug 8, 2017 at 5:42

1 Answer 1

3

Not sure Why did you created your suite file under "Referenced Libraries"

create it under "com.multibrowser" package. or under another folder.

take a look at screenshot below, testng-suite.xml.

enter image description here


Right click your suite file, click Run as -> Run Configurations. you will some thing like below,

enter image description here

Right Click testng and give new, Then choose your suite and give run, as per screenshot. enter image description here

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

5 Comments

If its not helping, comment here. we have to check whether proper Jar are added to library path,
I created the testng.xml file in com.multibrowser package now as you said. But still nothing iw working for me. I have updated Testng to its latest version. I am using Java 1.7 and Eclipse luna.
It is working for me only when I do as you mentioned(through run configurations). But again coming back to project folder and trying to run it as testng suite nothing will work. Every time should I do the same ?
Yes if you want to run the suite. You have to select suite.
If I need to run just class by right click, what needs to be done ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.