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">
        <class name="testSuite.TestConfig" />
        <class name="testSuite.TestOrder" />

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

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.


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

|improve this answer|||||
  • can i make any annotations in xml file rather than java file? – Emmanuel Angelo.R Apr 17 '14 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 '14 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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