Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrationtests2 #34

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@
</dependency>
-->

<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-verifier</artifactId>
<version>1.6</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>eu.stamp-project</groupId>
<artifactId>descartes</artifactId>
Expand All @@ -176,6 +183,18 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<excludes>
<exclude>dnoo/**/*</exclude>
<exclude>dnoo5/**/*</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -241,6 +260,7 @@
<build>
<plugins>
<!-- Testing : run verify_pitmp.sh after mvn install -->
<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand All @@ -261,6 +281,20 @@
</arguments>
</configuration>
</plugin>
-->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -340,4 +374,4 @@
</profile>
</profiles>

</project>
</project>
94 changes: 94 additions & 0 deletions src/test/java/org/pitest/maven/PmpMojoIT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package org.pitest.maven;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import org.apache.maven.it.VerificationException;
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import org.apache.maven.shared.utils.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

@RunWith(Parameterized.class)
public class PmpMojoIT {

private static final String LOG_FILENAME = "log.out";

@Parameter(0)
public String pitTestMavenVersion;

@Parameter(1)
public String pitmpMavenPluginVersion;

@Parameter(2)
public String projectPath;

@Parameter(3)
public String pomPath;

private Verifier verifier;

@Rule
public TemporaryFolder testFolder = new TemporaryFolder();

@Rule
public TestName testName = new TestName();

@Parameters(name = "{index}: Project: {2}, Pom Path: {3}, Pit Test Version: {0}, Pitmp Version: {1} ")
public static Collection<Object[]> configuration() {
return Arrays.asList(new Object[][] {
{ "1.4.2", "1.3.7-SNAPSHOT", "/dhell", "pom.xml.pitmp.conf1.xml" },
{ "1.4.2", "1.3.7-SNAPSHOT", "/dhell", "pom.xml.pitmp.noconf.xml" },

{ "1.4.2", "1.3.7-SNAPSHOT", "/dhell5", "pom.xml.pitmp.conf1.xml" },
{ "1.4.2", "1.3.7-SNAPSHOT", "/dhell5", "pom.xml.pitmp.noconf.xml" },

{ "1.4.2", "1.3.7-SNAPSHOT", "/dnoo", "pom.xml.pitmp.conf1.xml" },
{ "1.4.2", "1.3.7-SNAPSHOT", "/dnoo", "pom.xml.pitmp.noconf.xml" },

{ "1.4.2", "1.3.7-SNAPSHOT", "/dnoo5", "pom.xml.pitmp.conf1.xml" },
{ "1.4.2", "1.3.7-SNAPSHOT", "/dnoo5", "pom.xml.pitmp.noconf.xml" },
});
}

@Test
public void testDefaultConfiguration() throws Exception {
prepare(projectPath);
// goals
List<String> goals = new ArrayList<String>();
goals.add("clean");
goals.add("install");
goals.add("pitmp:run");
// client options
List<String> cliOptions = new ArrayList<String>();
cliOptions.add("-Dpitest-maven-version=" + pitTestMavenVersion);
cliOptions.add("-Dpitmp-maven-plugin-version=" + pitmpMavenPluginVersion);
verifier.setCliOptions(cliOptions);
verifier.executeGoals(goals);
verifier.verifyErrorFreeLog();
}

private File prepare(String testPath) throws IOException, VerificationException {
String path = ResourceExtractor.extractResourcePath(getClass(), testPath, testFolder.getRoot(), true)
.getAbsolutePath();
verifier = new Verifier(path);
verifier.setAutoclean(true);
verifier.setDebug(true);
verifier.setLogFileName(LOG_FILENAME);

FileUtils.rename(new File(path + File.separator + pomPath), new File(path + File.separator + "pom.xml"));
return new File(testFolder.getRoot().getAbsolutePath() + testPath);
}

}
74 changes: 74 additions & 0 deletions src/test/resources/dhell/pom.xml.pitmp.conf1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>eu.stamp-project.examples</groupId>
<artifactId>hello_app</artifactId>
<version>1.2.2</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<default.encoding>UTF-8</default.encoding>
<pitest-maven-version>1.4.2</pitest-maven-version>
<pitmp-maven-plugin-version>1.3.5-SNAPSHOT</pitmp-maven-plugin-version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>${pitest-maven-version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>eu.stamp-project</groupId>
<artifactId>pitmp-maven-plugin</artifactId>
<version>${pitmp-maven-plugin-version}</version>
<configuration>
<targetClasses>
<param>eu.stamp_project.examples.dhell*</param>
</targetClasses>
<excludedClasses>
<param>eu.stamp_project.examples.dhell.MyLogger</param>
</excludedClasses>
<excludedMethods>
<param>eu.stamp_project.examples.dhell.MyStorage.deleteFile</param>
<param>eu.stamp_project.examples.dhell.HelloApp.myPrint</param>
<param>eu.stamp_project.examples.dhell.HelloApp.cardMyTraces</param>
<param>eu.stamp_project.examples.dhell.HelloApp.getMyTraces</param>
</excludedMethods>
</configuration>
</plugin>

<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>.</directory>
<includes>
<include>*.txt</include>
<include>*.traces</include>
<include>*.log</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>

</project>
60 changes: 60 additions & 0 deletions src/test/resources/dhell/pom.xml.pitmp.noconf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>eu.stamp-project.examples</groupId>
<artifactId>hello_app</artifactId>
<version>1.2.2</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<default.encoding>UTF-8</default.encoding>
<pitest-maven-version>1.4.2</pitest-maven-version>
<pitmp-maven-plugin-version>1.3.5-SNAPSHOT</pitmp-maven-plugin-version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>${pitest-maven-version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>eu.stamp-project</groupId>
<artifactId>pitmp-maven-plugin</artifactId>
<version>${pitmp-maven-plugin-version}</version>
</plugin>

<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>.</directory>
<includes>
<include>*.txt</include>
<include>*.traces</include>
<include>*.log</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>

</project>
Loading