mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 13:35:50 +00:00
Adds integration test & edits Jenkins pipeline accordingly
This commit is contained in:
parent
67481fe73b
commit
3ca5d64a22
3 changed files with 275 additions and 222 deletions
10
Jenkinsfile
vendored
10
Jenkinsfile
vendored
|
@ -18,7 +18,15 @@ node {
|
|||
|
||||
stage('Test') {
|
||||
String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606";
|
||||
mvn "${jacoco}:prepare-agent verify ${jacoco}:report"
|
||||
mvn "${jacoco}:prepare-agent test ${jacoco}:report"
|
||||
|
||||
// Archive JUnit results, if any
|
||||
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml'
|
||||
}
|
||||
|
||||
stage('Integration Test') {
|
||||
String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606";
|
||||
mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration"
|
||||
|
||||
// Archive JUnit results, if any
|
||||
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
|
||||
|
|
21
pom.xml
21
pom.xml
|
@ -142,12 +142,26 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${cobertura.version}</version>
|
||||
<configuration>
|
||||
<check />
|
||||
<check/>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -194,7 +208,8 @@
|
|||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
|
||||
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory
|
||||
</wroManagerFactory>
|
||||
<cssDestinationFolder>${project.build.directory}/classes/static/resources/css</cssDestinationFolder>
|
||||
<wroFile>${basedir}/src/main/wro/wro.xml</wroFile>
|
||||
<extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
|
||||
|
@ -221,7 +236,7 @@
|
|||
<formats>
|
||||
<format>html</format>
|
||||
</formats>
|
||||
<check />
|
||||
<check/>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package org.springframework.samples.petclinic.owner;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@Ignore
|
||||
public class OwnerControllerITCase {
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
/**
|
||||
* Note: This test exists only for the purpose of serving as an example! Please write tests more sensible
|
||||
* than this for your own applications.
|
||||
*/
|
||||
@Test
|
||||
public void assertsUser1IsGeorgeFranklin() {
|
||||
String body = this.restTemplate.getForObject("/owners/1", String.class);
|
||||
assertThat(body).contains("<td><b>George Franklin</b></td>");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue