How to execute multiple classes at once using TestNG?

0 votes
I have just started learning selenium and was wondering that if there is a possible way of executing multiple classes at once in TestNG?

Can someone help?
Dec 26, 2018 in Selenium by Sradha
• 1,750 points
2,017 views

1 answer to this question.

0 votes

Hey @Sradha, Yes it is possible in TestNG.

All you need to do is create a XML file and list all the different class you want to test at once.

Here is the syntax:

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

<suite name = "TestNG">

    <test = "Testing TestNG">
    
        <classes>
        
            <class name = "testNG.class1"/>
            <class name = "testNG.class2"/>
            <class name = "testNG.class3"/>
            
        </classes>
        
    </test>

</suite>

This way you can run the test cases in each class at once.

answered Dec 26, 2018 by Rashmi

Hi, 

I am facing the below issue, please help if you can

Running multiple classes but classes contain priority set 1, 2, 3

xml:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="REGRESSION_TEST_SET" parallel="tests" thread-count="3" preserve-order="true">
    <test name="MOBILE" >

        <classes>
            <class name="LoginTest"/>
            <!--<class name="StopSizeTest" />-->
        </classes>
    </test>
</suite>
Above is the xml , so what happening is - it executed class Login Test with priority 1 test case and then jump to Class StopsizeTest with priority 1 test case
All i want is to execute class login test first with all priority test 1, 2 and 3 then come to class stopsize test run all priority of that class
Please help 
So basically you want to run the tests from a single class at the same time. Is that your query?

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

Need to perform parallel execution (multiple browser sessions) with Selenium & TestNG by using @BeforeSuite

@Beforesuite annotated method runs before the testNG.XML ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,520 points
3,002 views
0 votes
1 answer

How to Stop a For-Loop at a special number using Python

driver.find_elements_by_tag_name() returns a list of WebElements. You can use options ...READ MORE

answered May 25, 2018 in Selenium by Samarpit
• 5,890 points
84 views
+1 vote
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,520 points
4,010 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,954 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,899 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
3,326 views
0 votes
1 answer
0 votes
1 answer