Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to select the test type to run
Also makes sure unit tests run before @QuarkusTest based tests, and fixes a dev mode startup time regression.
- Loading branch information
1 parent
ed1e899
commit 2558fe4
Showing
10 changed files
with
160 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.quarkus.deployment.dev.testing; | ||
|
||
public enum TestType { | ||
UNIT, | ||
QUARKUS_TEST, | ||
ALL | ||
} |
43 changes: 43 additions & 0 deletions
43
...tp/deployment/src/test/java/io/quarkus/vertx/http/testrunner/QuarkusTestTypeTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.quarkus.vertx.http.testrunner; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.quarkus.vertx.http.deployment.devmode.tests.TestStatus; | ||
|
||
public class QuarkusTestTypeTestCase { | ||
|
||
@RegisterExtension | ||
static QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.setArchiveProducer(new Supplier<JavaArchive>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class).addClass(HelloResource.class) | ||
.add(new StringAsset(TestRunnerTestUtils.appProperties("quarkus.test.test-type=quarkus-test")), | ||
"application.properties"); | ||
} | ||
}) | ||
.setTestArchiveProducer(new Supplier<JavaArchive>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class).addClasses(SimpleET.class, UnitET.class); | ||
} | ||
}); | ||
|
||
@Test | ||
public void testQuarkusTestMode() throws InterruptedException { | ||
TestStatus ts = TestRunnerTestUtils.waitForFirstRunToComplete(); | ||
Assertions.assertEquals(1L, ts.getLastRun()); | ||
Assertions.assertEquals(1L, ts.getTestsFailed()); | ||
Assertions.assertEquals(1L, ts.getTestsPassed()); | ||
Assertions.assertEquals(0L, ts.getTestsSkipped()); | ||
Assertions.assertEquals(-1L, ts.getRunning()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...-http/deployment/src/test/java/io/quarkus/vertx/http/testrunner/UnitTestTypeTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.quarkus.vertx.http.testrunner; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.quarkus.vertx.http.deployment.devmode.tests.TestStatus; | ||
|
||
public class UnitTestTypeTestCase { | ||
|
||
@RegisterExtension | ||
static QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.setArchiveProducer(new Supplier<JavaArchive>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class).addClass(HelloResource.class) | ||
.add(new StringAsset(TestRunnerTestUtils.appProperties("quarkus.test.test-type=unit")), | ||
"application.properties"); | ||
} | ||
}) | ||
.setTestArchiveProducer(new Supplier<JavaArchive>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class).addClasses(SimpleET.class, UnitET.class); | ||
} | ||
}); | ||
|
||
@Test | ||
public void testUnitMode() throws InterruptedException { | ||
TestStatus ts = TestRunnerTestUtils.waitForFirstRunToComplete(); | ||
Assertions.assertEquals(1L, ts.getLastRun()); | ||
Assertions.assertEquals(1L, ts.getTestsFailed()); | ||
Assertions.assertEquals(0L, ts.getTestsPassed()); | ||
Assertions.assertEquals(0L, ts.getTestsSkipped()); | ||
Assertions.assertEquals(-1L, ts.getRunning()); | ||
|
||
} | ||
} |