Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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