Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizPlease log in to access this content. You will be redirected to the login page shortly.
LoginHow to run multiple test suite in selenium by using testing?
Software Testing Selenium in Software Testing . 3 years ago
We can configure our WebDriver test or WebDriver test suites for software testing project in testng.xml file. If we have two/multiple classes in test suite we can run those classes in the same test as well as two different tests too. Let's take a simple example here:
Create 3 classes under project = TestNGOne and package = TestNGOnePack as below.
BaseClassOne will be used for initializing and closing WebDriver instance,
ClassOne and ClassTwo will be used as test classes.
The above class will be base class and be used to initialize and close the WebDriver instance.
Above ClassOne is inherited or created from BaseClassOne.
Above ClassTwo is also inherited or created from BaseClassOne.
Configure testng.xml to run two classes in one test:
Copy the below-given lines in the testng.xml file and run it as TestNg Suite.
<suite name="Suite One" > <test name="Test One" > <classes> <class name="TestNGOnePack.ClassOne" /> <class name="TestNGOnePack.ClassTwo" /> </classes> </test> </suite>When execution is completed, View execution results report.
Configure testng.xml to run two classes in two tests:
Now if we want to run both classes as SEPARATE test then we have to configure testng.xml file as below
<suite name="Suite One" > <test name="Test One" > <classes> <class name="TestNGOnePack.ClassOne" /> </classes> </test> <test name="Test Two" > <classes> <class name="TestNGOnePack.ClassTwo" /> </classes> </test> </suite>Here, "ClassOne" is included in 'Test One" test and "ClassTwo" is included in 'Test Two" test. Now run below given testng.xml file and verify results.
After comparing both results. In the 1st example, Both classes are executed under the same test but in the second example, both classes are executed under separate tests. This way you can configure the testng.xml file as per your requirement.
Posted on 31 May 2022, this text provides information on Software Testing related to Selenium in Software Testing. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.