Running Test Suites
Running Test Suites From IDE
To run the test suite from your IDE, right click on the testng.xml file in the side navigation bar. Then click on the option ‘Run testng.xml’ to run your suite:
Running test suites from command line
To run test suites from command line, navigate to the root directory of your project in the terminal and type:
mvn test
This will automatically compile tests as:
Then the testng.xml file will be automatically run as:
Finally you will see the following result logged on the console as:
Configuring test suite execution options
1. Thread Count
TestNG provides you with the option to define the number of threads you want to use to run your test suite. This can be simply achieved as:
<suite name="MySuite" thread-count="10">
</suite>
You have to assign an integer value to the attribute ‘thread-count’ and you are done.
2. Parallel Execution
You can also configure your test suite to allow your tests to run in parallel. To know more on how to parallelize your tests, click here.
How to Create Test Suite in TestNG?
In this article we will learn about test suites and how can we build them using Java and TestNG. TestNG is a modern testing framework that is used very widely used today. It has a broad base of features that allow us to write unit tests and club them together in groups.
Table of Content
- What is a Test Suite?
- Steps to Create Test Suite in TestNG
- Understanding TestNG XML Configuration
- Creating Test Suites Using TestNG XML
- Running Test Suites
- Conclusion
- FAQ’s on How to Create Test Suite in TestNG
TestNG is used in combination with Selenium to implement browser automation and therefore used for regression testing. By the end of this article, you will be successfully creating and running your own test suites.