BAEL-5242: Add surefire config for TestNG (#11471)

* BAEL-5242: Add surefire config for TestNG

* BAEL-5242: Configure surefire to run unit and integration tests
This commit is contained in:
kwoyke 2021-11-23 06:26:31 +01:00 committed by GitHub
parent ffacd9b9ae
commit 1ee2327ab3
3 changed files with 60 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>testng</artifactId>
<version>0.1.0-SNAPSHOT</version>
@ -16,7 +16,6 @@
</parent>
<dependencies>
<!-- test scoped -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@ -41,8 +40,46 @@
</testResources>
</build>
<profiles>
<profile>
<id>default-second</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src\test\resources\parametrized_testng.xml</suiteXmlFile>
<suiteXmlFile>src\test\resources\test_suite.xml</suiteXmlFile>
<suiteXmlFile>src\test\resources\test_unit.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-lite-second</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src\test\resources\test_group.xml</suiteXmlFile>
<suiteXmlFile>src\test\resources\test_setup.xml</suiteXmlFile>
<suiteXmlFile>src\test\resources\test_int.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<!-- testing -->
<testng.version>7.1.0</testng.version>
</properties>

View File

@ -0,0 +1,10 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="int">
<test name="integration tests">
<classes>
<class name="com.baeldung.GroupIntegrationTest" />
<class name="com.baeldung.MultiThreadedIntegrationTest" />
<class name="com.baeldung.TimeOutIntegrationTest" />
</classes>
</test>
</suite>

View File

@ -0,0 +1,9 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="unit">
<test name="unit tests">
<classes>
<class name="com.baeldung.DependentLongRunningUnitTest" />
<class name="com.baeldung.PriorityLongRunningUnitTest" />
</classes>
</test>
</suite>