mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 21:15:50 +00:00
Selenium now uses the failsafe plugin
This commit is contained in:
parent
162f863026
commit
3fffb7234e
8 changed files with 93 additions and 58 deletions
13
.travis.yml
13
.travis.yml
|
@ -10,8 +10,19 @@ addons:
|
|||
|
||||
jdk: oraclejdk8
|
||||
|
||||
install:
|
||||
- docker-compose build
|
||||
|
||||
before_script:
|
||||
- docker-compose up -d
|
||||
|
||||
script:
|
||||
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar
|
||||
- mvn verify -Dskip.surefire.tests
|
||||
# - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar
|
||||
|
||||
after_script:
|
||||
- docker-compose stop
|
||||
- docker-compose rm
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
|
34
Dockerfile
34
Dockerfile
|
@ -1,17 +1,17 @@
|
|||
FROM maven:latest
|
||||
|
||||
# Set the workdir
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the source to the container
|
||||
COPY . .
|
||||
|
||||
# Build the project
|
||||
RUN mvn package
|
||||
|
||||
# Make the jar executable
|
||||
RUN sh -c 'touch target/spring-petclinic-*.jar'
|
||||
|
||||
#Start the project
|
||||
ENV JAVA_OPTS=""
|
||||
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar target/spring-petclinic-*.jar" ]
|
||||
FROM maven:latest
|
||||
|
||||
# Set the workdir
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the source to the container
|
||||
COPY . .
|
||||
|
||||
# Build the project
|
||||
RUN mvn package -Dskip.failsafe.tests
|
||||
|
||||
# Make the jar executable
|
||||
RUN sh -c 'touch target/spring-petclinic-*.jar'
|
||||
|
||||
#Start the project
|
||||
ENV JAVA_OPTS=""
|
||||
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar target/spring-petclinic-*.jar" ]
|
||||
|
|
28
pom.xml
28
pom.xml
|
@ -128,6 +128,34 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- skips surefire tests without skipping failsafe tests.
|
||||
Property value seems to magically default to false -->
|
||||
<skipTests>${skip.surefire.tests}</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- skips failsafe tests without skipping surefire tests.
|
||||
Property value seems to magically default to false -->
|
||||
<skipTests>${skip.failsafe.tests}</skipTests>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>run-integration-tests</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
|
|
@ -14,14 +14,14 @@ import java.net.MalformedURLException;
|
|||
* @author Martijn
|
||||
* @since 21-6-2017.
|
||||
*/
|
||||
public class AddOwnerTest extends SeleniumBaseTest {
|
||||
public AddOwnerTest() throws MalformedURLException {
|
||||
public class AddOwnerIT extends SeleniumBaseIT {
|
||||
public AddOwnerIT() throws MalformedURLException {
|
||||
super();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Category(SeleniumBaseTest.class)
|
||||
public void addOwnerTest() {
|
||||
@Category(SeleniumBaseIT.class)
|
||||
public void addOwnerIT() {
|
||||
driver.get(BASE_URL+"/owners/new");
|
||||
|
||||
//Add an owner
|
26
src/test/java/nl/utwente/bpsd/selenium/FailingIT.java
Normal file
26
src/test/java/nl/utwente/bpsd/selenium/FailingIT.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package nl.utwente.bpsd.selenium;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
/**
|
||||
* @author Martijn
|
||||
* @since 21-6-2017.
|
||||
*/
|
||||
public class FailingIT extends SeleniumBaseIT {
|
||||
public FailingIT() throws MalformedURLException {
|
||||
super();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Category(SeleniumBaseIT.class)
|
||||
@Ignore
|
||||
public void failIT() {
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package nl.utwente.bpsd.selenium;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
/**
|
||||
* @author Martijn
|
||||
* @since 21-6-2017.
|
||||
*/
|
||||
public class FailingTest extends SeleniumBaseTest {
|
||||
public FailingTest() throws MalformedURLException {
|
||||
super();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Category(SeleniumBaseTest.class)
|
||||
public void failTest() {
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
}
|
|
@ -4,8 +4,6 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
|
@ -14,14 +12,14 @@ import java.net.MalformedURLException;
|
|||
* @author Martijn
|
||||
* @since 21-6-2017.
|
||||
*/
|
||||
public class FindOwnerTest extends SeleniumBaseTest {
|
||||
public FindOwnerTest() throws MalformedURLException {
|
||||
public class FindOwnerIT extends SeleniumBaseIT {
|
||||
public FindOwnerIT() throws MalformedURLException {
|
||||
super();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Category(SeleniumBaseTest.class)
|
||||
public void findOwnerTest() {
|
||||
@Category(SeleniumBaseIT.class)
|
||||
public void findOwnerIT() {
|
||||
driver.get(BASE_URL+"/owners/find");
|
||||
fillTextField(By.name("lastName"),"Coleman");
|
||||
driver.findElement(By.name("lastName")).submit();
|
|
@ -14,12 +14,12 @@ import java.net.URL;
|
|||
* @author Martijn
|
||||
* @since 21-6-2017.
|
||||
*/
|
||||
public class SeleniumBaseTest {
|
||||
public class SeleniumBaseIT {
|
||||
protected final RemoteWebDriver driver;
|
||||
public static final String BASE_URL = "http://pet-clinic:8080/";
|
||||
// public static final String BASE_URL = "http://localhost:8080/";
|
||||
|
||||
public SeleniumBaseTest() throws MalformedURLException {
|
||||
public SeleniumBaseIT() throws MalformedURLException {
|
||||
// System.setProperty("webdriver.chrome.driver","C:\\Users\\marti\\Downloads\\chromedriver_win32\\chromedriver.exe");
|
||||
// this.driver = new ChromeDriver();
|
||||
this.driver = new RemoteWebDriver(new URL("http://selenium:4444/wd/hub"), DesiredCapabilities.firefox());
|
Loading…
Reference in a new issue