Skip to content

Commit 712c021

Browse files
committed
UT & IT Separation
Separating unit and integration tests with maven surefire plugin
1 parent 9945af5 commit 712c021

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

ut-it-separation/pom.xml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.fd</groupId>
8+
<artifactId>ut-it-separation</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
14+
<java-version>1.8</java-version>
15+
<maven.compiler.source>1.8</maven.compiler.source>
16+
<maven.compiler.target>1.8</maven.compiler.target>
17+
18+
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
19+
20+
<testng.version>6.14.3</testng.version>
21+
<hamcrest-version>1.3</hamcrest-version>
22+
<lombok-version>1.18.2</lombok-version>
23+
</properties>
24+
25+
<dependencies>
26+
<dependency>
27+
<groupId>org.testng</groupId>
28+
<artifactId>testng</artifactId>
29+
<version>${testng.version}</version>
30+
<scope>test</scope>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.hamcrest</groupId>
35+
<artifactId>hamcrest-all</artifactId>
36+
<version>${hamcrest-version}</version>
37+
<scope>test</scope>
38+
</dependency>
39+
</dependencies>
40+
41+
<build>
42+
<plugins>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-surefire-plugin</artifactId>
46+
<version>${maven-surefire-plugin.version}</version>
47+
<configuration>
48+
<excludes>
49+
<exclude>**/*IntegrationTest.java</exclude>
50+
</excludes>
51+
</configuration>
52+
<executions>
53+
<execution>
54+
<id>integration-test</id>
55+
<goals>
56+
<goal>test</goal>
57+
</goals>
58+
<phase>integration-test</phase>
59+
<configuration>
60+
<skipTests>${skip.surefire.tests}</skipTests>
61+
<excludes>
62+
<exclude>none</exclude>
63+
</excludes>
64+
<includes>
65+
<include>**/*IntegrationTest.java</include>
66+
</includes>
67+
</configuration>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
74+
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.fd.tryout.test.integration;
2+
3+
import org.testng.annotations.Test;
4+
5+
import static org.hamcrest.MatcherAssert.assertThat;
6+
import static org.hamcrest.Matchers.is;
7+
8+
/**
9+
* @author furkand
10+
* 10/16/2018 11:43 AM
11+
*/
12+
public class SampleIntegrationTest {
13+
14+
@Test
15+
public void testSampleUnit() {
16+
System.out.println("Sample integration test");
17+
assertThat(true, is(true));
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.fd.tryout.test.unit;
2+
3+
import org.testng.annotations.Test;
4+
5+
import static org.hamcrest.MatcherAssert.assertThat;
6+
import static org.hamcrest.Matchers.is;
7+
8+
/**
9+
* @author furkand
10+
* 10/16/2018 11:43 AM
11+
*/
12+
public class SampleUnitTest {
13+
14+
@Test
15+
public void testSampleUnit() {
16+
System.out.println("Sample unit test");
17+
assertThat(true, is(true));
18+
}
19+
}

0 commit comments

Comments
 (0)