On 22 Jan 2015, at 21:58, David Karr <davidmic...@gmail.com> wrote:
I've seen some "greenfield" examples of setting up Spock tests in a Maven build, but what if I have an existing Maven build with Java unit tests, and I want to add or experiment with Spock tests, in addition to the Java unit tests? I know that Surefire needs to be configured to now add "*Spec.java" (apparently not "*Spec.groovy", the logical choice) in addition to the existing "*Test.java". What plugins and configuration do I need to add, and would I likely have existing plugins that now have to work with both Java and Groovy?
--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spockframewor...@googlegroups.com.
To post to this group, send email to spockfr...@googlegroups.com.
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Hi,
I've done Junit/Spock parallel projects several times. You can find my standard pom at https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml.
Running mvn test will execute both, Junit and Spock and Jenkins should be able to find both test result files.
Kind regards
Micha
--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spockframework+unsubscribe@googlegroups.com.
To post to this group, send email to spockframework@googlegroups.com.
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>minimalspock</groupId>
<artifactId>minimalspock</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spock Framework - Example Project</name>
<prerequisites>
<maven>3.0.5</maven>
</prerequisites>
<properties>
<java.version>1.7</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<!-- Without joint compilation - no dependencies between Java and Groovy (inheritance)-->
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>
<directory>${project.basedir}/src/main/java</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
<testSources>
<testSource>
<directory>${project.basedir}/src/test/java</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</testSource>
</testSources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/*Spec.java</include>
<!-- Yes, .java extension -->
<include>**/*Test.java</include>
<!-- Just in case having "normal" JUnit tests -->
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spockframewor...@googlegroups.com.
To post to this group, send email to spockfr...@googlegroups.com.
Hi,
I've done Junit/Spock parallel projects several times. You can find my standard pom at https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml.
Running mvn test will execute both, Junit and Spock and Jenkins should be able to find both test result files.
Kind regards
MichaJohn Allen <jmane...@gmail.com> schrieb am Fr., 13. März 2015 17:19:
I am just learning Spock, and I would lovelovelove to use it. But we need to run tests automatically in Jenkins via Maven on projects that also contain JUnit tests.In other words we have an existing Eclipse (STS) Java project with JUnit tests, and I want to add Spock tests to it going forward.Is this the way to do it?
- Follow instructions at http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html (updating version numbers).
- Convert Java project to Groovy project. Can Jenkins run Groovy project JUnit and Spock tests?
- Create new Spock packages. Or can I put them into folders that already have JUnit tests?
- Write Spock tests.
I hope that can work. I have been reading and experimenting and spinning my wheels a lot.--John
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spockframewor...@googlegroups.com.
To post to this group, send email to spockfr...@googlegroups.com.
Visit this group at https://groups.google.com/group/spockframework.