Micha Kops avatar Micha Kops committed 9645112

Tests suite examples added.

Comments (0)

Files changed (7)

 						<groupId>org.apache.maven.plugins</groupId>
 						<artifactId>maven-surefire-plugin</artifactId>
 						<configuration>
-							<groups>com.hascode.tutorial.test.group.FastTests</groups>
+							<groups>com.hascode.tutorial.test.group.FastRunningTests</groups>
 						</configuration>
 					</plugin>
 				</plugins>
 						<groupId>org.apache.maven.plugins</groupId>
 						<artifactId>maven-surefire-plugin</artifactId>
 						<configuration>
-							<groups>com.hascode.tutorial.test.group.SlowTests</groups>
+							<groups>com.hascode.tutorial.test.group.SlowRunningTests</groups>
 						</configuration>
 					</plugin>
 				</plugins>

src/test/java/com/hascode/tutorial/test/FirstTest.java

 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import com.hascode.tutorial.test.group.FastTests;
+import com.hascode.tutorial.test.group.FastRunningTests;
 
-@Category({ FastTests.class })
+@Category({ FastRunningTests.class })
 public class FirstTest {
 	@Test
 	public void testSth() throws Exception {

src/test/java/com/hascode/tutorial/test/SecondTest.java

 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import com.hascode.tutorial.test.group.FastTests;
-import com.hascode.tutorial.test.group.SlowTests;
+import com.hascode.tutorial.test.group.FastRunningTests;
+import com.hascode.tutorial.test.group.SlowRunningTests;
 
 public class SecondTest {
 	@Test
-	@Category({ FastTests.class, SlowTests.class })
+	@Category({ FastRunningTests.class, SlowRunningTests.class })
 	public void testSth() throws Exception {
 		System.out.println("SecondTest.testSth run");
 		assertTrue(true);
 	}
 
 	@Test
-	@Category({ SlowTests.class })
+	@Category({ SlowRunningTests.class })
 	public void testAnotherThing() throws Exception {
 		System.out.println("SecondTest.testAnotherThing run");
 		assertTrue(true);

src/test/java/com/hascode/tutorial/test/group/FastRunningTests.java

+package com.hascode.tutorial.test.group;
+
+/**
+ * Marker interface for fast-running tests.
+ */
+public interface FastRunningTests {
+}

src/test/java/com/hascode/tutorial/test/group/SlowRunningTests.java

+package com.hascode.tutorial.test.group;
+
+/**
+ * Marker interface for slow-running tests.
+ */
+public interface SlowRunningTests {
+
+}

src/test/java/com/hascode/tutorial/test/suite/FastRunningTestSuite.java

+package com.hascode.tutorial.test.suite;
+
+import org.junit.experimental.categories.Categories;
+import org.junit.experimental.categories.Categories.IncludeCategory;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+import com.hascode.tutorial.test.FirstTest;
+import com.hascode.tutorial.test.SecondTest;
+import com.hascode.tutorial.test.group.FastRunningTests;
+
+@RunWith(Categories.class)
+@IncludeCategory(FastRunningTests.class)
+@SuiteClasses({ FirstTest.class, SecondTest.class })
+public class FastRunningTestSuite {
+
+}

src/test/java/com/hascode/tutorial/test/suite/SlowRunningTestSuite.java

+package com.hascode.tutorial.test.suite;
+
+import org.junit.experimental.categories.Categories;
+import org.junit.experimental.categories.Categories.IncludeCategory;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+import com.hascode.tutorial.test.FirstTest;
+import com.hascode.tutorial.test.SecondTest;
+import com.hascode.tutorial.test.group.SlowRunningTests;
+
+@RunWith(Categories.class)
+@IncludeCategory(SlowRunningTests.class)
+@SuiteClasses({ FirstTest.class, SecondTest.class })
+public class SlowRunningTestSuite {
+
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.