Last active
April 6, 2018 11:56
-
-
Save ddossot/277699b86d0748639a95 to your computer and use it in GitHub Desktop.
Integration tests with REST Assured and Jetty
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
@BeforeClass | |
public static void configureRestAssured() throws Exception | |
{ | |
RestAssured.port = Integer.getInteger("api.server.port"); | |
RestAssured.basePath = System.getProperty("api.server.path") + "/api/v1"; | |
} |
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
<plugin> | |
<groupId>org.eclipse.jetty</groupId> | |
<artifactId>jetty-maven-plugin</artifactId> | |
<version>${jetty-plugin.version}</version> | |
<configuration> | |
<webApp> | |
<contextPath>${local.server.path}</contextPath> | |
</webApp> | |
<httpConnector> | |
<port>${local.server.port}</port> | |
</httpConnector> | |
<stopKey>rest-tests-jetty</stopKey> | |
<stopPort>${local.server.stop-port}</stopPort> | |
</configuration> | |
<executions> | |
<execution> | |
<id>start-jetty</id> | |
<phase>pre-integration-test</phase> | |
<goals> | |
<goal>deploy-war</goal> | |
</goals> | |
<configuration> | |
<daemon>true</daemon> | |
<scanIntervalSeconds>0</scanIntervalSeconds> | |
</configuration> | |
</execution> | |
<execution> | |
<id>stop-jetty</id> | |
<phase>post-integration-test</phase> | |
<goals> | |
<goal>stop</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-failsafe-plugin</artifactId> | |
<version>2.17</version> | |
<configuration> | |
<systemPropertyVariables> | |
<api.server.port>${local.server.port}</api.server.port> | |
<api.server.path>${local.server.path}</api.server.path> | |
</systemPropertyVariables> | |
</configuration> | |
<executions> | |
<execution> | |
<goals> | |
<goal>integration-test</goal> | |
<goal>verify</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> |
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
<jetty-plugin.version>9.2.2.v20140723</jetty-plugin.version> | |
<local.server.port>8889</local.server.port> | |
<local.server.path>/<_something that makes sense_></local.server.path> | |
<local.server.stop-port>8899</local.server.stop-port> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment