1

Iam new to selenium suite, please show me how to run an particular test in an test suite,

Below is my test suite,

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

<suite name="TestAll">

<test name="order">
    <classes>
        <class name="testSuite.TestConfig" />
        <class name="testSuite.TestOrder" />
    </classes>
</test>

<test name="database">  
    <classes>
        <class name="testSuite.TestConfig" />
        <class name="testSuite.TestDatabase" />
    </classes>
</test>
</suite>

I wanted to run the test that has name "database", but without deleting the test that has name "order", so is there any way to do it? please throw me the light.

1 Answer 1

1

There are two ways of proceeding with this.

  1. Go to the actual class file testSuite.TestOrder and change the @Test tag on the method to @Test(enabled="false") But you will have to recompile your class files every time you have to make a change.

  2. @Test(group={"ignore"}) TestNG has a group option which help you categorize the tests. Mark all test that you want to ignore during the run in the above format. Now modify the testng.xml

Use this and experiment around. http://www.tutorialspoint.com/testng/testng_tutorial.pdf

2
  • can i make any annotations in xml file rather than java file? Apr 17, 2014 at 10:50
  • No you have to put the annotations in the java file.You can control them at run time using testng.xml. That is you can include or exclude groups any which way you want in the xml.
    – MridulJ
    Apr 17, 2014 at 11:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.