From 0451f008bee8292564ce5a8b213601377c3be5ac Mon Sep 17 00:00:00 2001
From: dev-chirag <41482403+dev-chirag@users.noreply.github.com>
Date: Thu, 14 Nov 2019 03:06:39 +0530
Subject: [PATCH] BAEL-3236 Determine the execution time of JUnit Tests (#7985)
* BAEL3236 Execution time Junit
* BAEL3236 Execution time Junit
* BAEL3236 Added more test cases
* BAEL3236 Added more test cases
* BAEL3236 Renaming to integration test
* BAEL3236 Temporary enabling
* BAEL3236 Reverting Integration tests
* BAEL3236 Refactoring TCs
* BAEL3236 Refactoring TCs
* BAEL3236 Removing now unused spring and http client deps
* BAEL3236 Fixing test cases and updating the missed version in pom.xml
* BAEL3236 throwing Exception in TCs
---
testing-modules/junit-5/pom.xml | 7 +++-
.../time/SampleExecutionTimeUnitTest.java | 38 +++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/execution/time/SampleExecutionTimeUnitTest.java
diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml
index 96944b4dc6..a27e4da61b 100644
--- a/testing-modules/junit-5/pom.xml
+++ b/testing-modules/junit-5/pom.xml
@@ -124,9 +124,13 @@
com.baeldung.TestLauncher
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ ${surefire.report.plugin}
+
-
5.4.2
2.23.0
@@ -137,6 +141,7 @@
2.22.0
1.6.0
5.0.1.RELEASE
+ 3.0.0-M3
diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/execution/time/SampleExecutionTimeUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/execution/time/SampleExecutionTimeUnitTest.java
new file mode 100644
index 0000000000..7d43d1a560
--- /dev/null
+++ b/testing-modules/junit-5/src/test/java/com/baeldung/execution/time/SampleExecutionTimeUnitTest.java
@@ -0,0 +1,38 @@
+package com.baeldung.execution.time;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class SampleExecutionTimeUnitTest {
+
+ @Test
+ void someUnitTest() {
+
+ assertTrue(doSomething());
+ }
+
+// @Test
+// void someIntegrationTest() throws Exception {
+//
+// //simulate an operation that may take 5 seconds
+// Thread.sleep(5000);
+//
+// assertTrue(doSomething());
+// }
+//
+// @Test
+// void someEndToEndTest() throws Exception {
+//
+// //simulate an operation that may take 10 seconds
+// Thread.sleep(10000);
+//
+// assertTrue(doSomething());
+//
+// }
+
+ private boolean doSomething() {
+ return true;
+ }
+}