Testng Executes Multiple Suite

We know the configuration file of testng, there can only be one suite in an .xml, so what if you want to set up multiple suites? At this time we need to use the testng tag .

Let’s talk about an example I made. First, I have two suites, one is UItest.xml and the other is APITest.xml. The code is as follows:

UITest.xml:







<class name="testcase.CheckLink">class>


APITest.xml:







<class name="APITestcase.CheckWeather">class>


At this time, I also talk about the detours I have taken. My project uses maven, and maven uses when linking testng files. , As shown in the figure below:




src/test/resources/testng.xml

Initially I thought that as long as one more was configured, it was fine. After trying it, I found that it was not feasible. You can see from the execution log that it has been After executing all the test classes, but the html test report only shows the test results of one suite, which is counterproductive, so I gave up this configuration method. Of course, this is also probably because maven+testng+reportng is related to the configuration. I don’t Understand the cause, I will update this method if it works in the future.

Let’s get back to the point. Finally, for the sake of brevity of the code, I also use a testng.xml to integrate APITest.xml and UITest.xml, as shown in the following figure:









Then just associate testng.xml in maven, and the final execution result is shown in the figure below:

Share a picture







<class name="testcase.CheckLink">class>








<class name="APITestcase.CheckWeather">class>





src/test/resources/testng.xml









WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2233 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.