Chapter 1. Verify test dependencies
For this tutorial, you must have a completed Quarkus Getting Started project and the project pom.xml file must include the quarkus-junit5 and rest-assured dependencies. These dependencies will be present if you completed the Quarkus Getting Started exercise or if you downloaded the completed example.
-
The
quarkus-junit5dependency is required for testing because it provides the@QuarkusTestannotation that controls the testing framework. The
rest-assureddependency is not required but you can use it as a convenient way to test HTTP endpoints.NoteQuarkus provides integration that automatically sets the correct URL, so no configuration is required.
Procedure
-
Open the Getting Started project
pom.xmlfile. Verify that the following dependencies are in the file and add them if necessary:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that your
pom.xmlfile includes themaven-surefire-plugin. Because this tutorial uses the JUnit 5 framework, the version of themaven-surefire-pluginmust be set because the default version does not support Junit 5:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Set the
java.util.logging.managersystem property to use the correct log manager for test. Verify that the
GreetingResourceTest.javafile contains the following content and add it if necessary:Copy to Clipboard Copied! Toggle word wrap Toggle overflow To run the test, enter the following command:
./mvnw clean verify
./mvnw clean verifyCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can also run the test directly from your IDE.
This test uses HTTP to directly test the REST endpoint. When the test is triggered, the application will start before the test runs.