How to add Spock tests to existing Maven build with Java unit tests?

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to add Spock tests to existing Maven build with Java unit tests?

David Karr
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Peter Niederwieser
Administrator
Basically, all you need is a Groovy plugin (to compile your specs) and Groovy/Spock dependencies. The Maven build in https://github.com/spockframework/spock-example has the details (although there are other Groovy plugins for Maven by now).

Cheers,
Peter

On 22 Jan 2015, at 21:58, David Karr <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Marcin Zajączkowski
In reply to this post by David Karr
On 2015-01-22 21:58, David Karr 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?

I have never tried (with Gradle it works out of the box), but maybe
following sample project would be useful for you:
https://github.com/msakamoto-sf/maven3-junit-spock-testng-mixin
(JUnit, TestNG and Spock)

Btw, there is a comment in pom.xml:
> (mysteriously, ".groovy" dosn't work for Spock's xxxxSpec.groovy, but ".java" work!!)

Marcin

--
http://blog.solidsoft.info/ - Working code is not enough

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

John Allen
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?
  1. Follow instructions at http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html (updating version numbers).
  2. Convert Java project to Groovy project.  Can Jenkins run Groovy project JUnit and Spock tests?
  3. Create new Spock packages.  Or can I put them into folders that already have JUnit tests?
  4. 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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Michael Kutz
In reply to this post by David Karr

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

John Allen <[hidden email]> 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?
  1. Follow instructions at http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html (updating version numbers).
  2. Convert Java project to Groovy project.  Can Jenkins run Groovy project JUnit and Spock tests?
  3. Create new Spock packages.  Or can I put them into folders that already have JUnit tests?
  4. 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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Sten Aksel Heien
In reply to this post by John Allen
To put groovy and java code in same folder (what I like) you need something like this:

<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>


On Friday, March 13, 2015 at 5:19:10 PM UTC+1, John Allen wrote:
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?
  1. Follow instructions at <a href="http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmrhaki.blogspot.com%2F2011%2F01%2Fspocklight-add-spock-support-to-java.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFDteBv2E9KGYo9oSHCCWym5rzw3w';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmrhaki.blogspot.com%2F2011%2F01%2Fspocklight-add-spock-support-to-java.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFDteBv2E9KGYo9oSHCCWym5rzw3w';return true;">http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html (updating version numbers).
  2. Convert Java project to Groovy project.  Can Jenkins run Groovy project JUnit and Spock tests?
  3. Create new Spock packages.  Or can I put them into folders that already have JUnit tests?
  4. 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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

John Allen
Now that I have it figured out after much trial and error, making Spock work in an Eclipse Java project is super easy.

1. Start with STS (Eclipse Luna 4.4).
2. Install Groovy/Grails Plugin.
(I unchecked Quicksearch, the two Pivotal Servers, and Spring Dashboard because STS already has them.)
(I unchecked Grails because we don't need it.)
3. Install Spock Plugin (Jspresso).  (This may not be needed.)
4. Modify pom.xml.  I did not make any real changes to your standard pom, Michael Kutz (thank you very much) at https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml.  Peter has those wonderful comments in the spock-example pom.xml, thank you, Peter.
5. Download new dependencies:  Select project in Package View and Run > Run As > Maven install.
6. Change Java project to Groovy project (since Groovy knows all about Java):  Select project, right click > Configure > Convert to Groovy Project.
7. Create a Spock test (even alongside a JUnit Java test) and Run > Run As > JUnit test.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Christopher Smith
Team,.

Does anyone have a sample project that include spring java components with this pom.xml and spock?



On Mon, Mar 16, 2015 at 5:14 PM, John Allen <[hidden email]> wrote:
Now that I have it figured out after much trial and error, making Spock work in an Eclipse Java project is super easy.

1. Start with STS (Eclipse Luna 4.4).
2. Install Groovy/Grails Plugin.
(I unchecked Quicksearch, the two Pivotal Servers, and Spring Dashboard because STS already has them.)
(I unchecked Grails because we don't need it.)
3. Install Spock Plugin (Jspresso).  (This may not be needed.)
4. Modify pom.xml.  I did not make any real changes to your standard pom, Michael Kutz (thank you very much) at https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml.  Peter has those wonderful comments in the spock-example pom.xml, thank you, Peter.
5. Download new dependencies:  Select project in Package View and Run > Run As > Maven install.
6. Change Java project to Groovy project (since Groovy knows all about Java):  Select project, right click > Configure > Convert to Groovy Project.
7. Create a Spock test (even alongside a JUnit Java test) and Run > Run As > JUnit test.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Przemysław Wojnowski
Hi.

Just take Spring config from other repositories, for example from here:
http://spock-framework.3207229.n2.nabble.com/Some-tutorials-for-Spock-Spring-Hibernate-Unitils-td7574043.html

Cheers,
Przemek

2015-03-20 19:18 GMT+01:00 Christopher Smith <[hidden email]>:
Team,.

Does anyone have a sample project that include spring java components with this pom.xml and spock?



On Mon, Mar 16, 2015 at 5:14 PM, John Allen <[hidden email]> wrote:
Now that I have it figured out after much trial and error, making Spock work in an Eclipse Java project is super easy.

1. Start with STS (Eclipse Luna 4.4).
2. Install Groovy/Grails Plugin.
(I unchecked Quicksearch, the two Pivotal Servers, and Spring Dashboard because STS already has them.)
(I unchecked Grails because we don't need it.)
3. Install Spock Plugin (Jspresso).  (This may not be needed.)
4. Modify pom.xml.  I did not make any real changes to your standard pom, Michael Kutz (thank you very much) at https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml.  Peter has those wonderful comments in the spock-example pom.xml, thank you, Peter.
5. Download new dependencies:  Select project in Package View and Run > Run As > Maven install.
6. Change Java project to Groovy project (since Groovy knows all about Java):  Select project, right click > Configure > Convert to Groovy Project.
7. Create a Spock test (even alongside a JUnit Java test) and Run > Run As > JUnit test.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Jose Juan Reyes
In reply to this post by David Karr
What if you publish your code? Maybe I could help you...

El jueves, 22 de enero de 2015, 14:58:46 (UTC-6), David Karr escribió:
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Dmitry Senkovich
In reply to this post by Michael Kutz
Hi Michael,

I'm working with Maven and Spock, my E2E tests need to be parallized as it run too long. Could please provide configuration that enabled you to run Spock tests concurrently?

Thank you.

On Friday, March 13, 2015 at 7:27:15 PM UTC+3, Michael Kutz wrote:

Hi,

I've done Junit/Spock parallel projects several times. You can find my standard pom at <a href="https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;">https://github.com/<a href="https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;">mkutz<a href="https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;">/demonstration/blob/master/<a href="https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;">spock-testing<a href="https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;">/<a href="https://github.com/mkutz/demonstration/blob/master/spock-testing/pom.xml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmkutz%2Fdemonstration%2Fblob%2Fmaster%2Fspock-testing%2Fpom.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2w3kB6IU2gggG6mT35Y6ndVoHIQ&#39;;return true;">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

John Allen <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="u59HAiFB5d8J" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jmane...@...> 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?
  1. Follow instructions at <a href="http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmrhaki.blogspot.com%2F2011%2F01%2Fspocklight-add-spock-support-to-java.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFDteBv2E9KGYo9oSHCCWym5rzw3w&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmrhaki.blogspot.com%2F2011%2F01%2Fspocklight-add-spock-support-to-java.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFDteBv2E9KGYo9oSHCCWym5rzw3w&#39;;return true;">http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html (updating version numbers).
  2. Convert Java project to Groovy project.  Can Jenkins run Groovy project JUnit and Spock tests?
  3. Create new Spock packages.  Or can I put them into folders that already have JUnit tests?
  4. 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="u59HAiFB5d8J" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">spockframewor...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="u59HAiFB5d8J" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">spockfr...@googlegroups.com.
Visit this group at <a href="http://groups.google.com/group/spockframework" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/spockframework&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/spockframework&#39;;return true;">http://groups.google.com/group/spockframework.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

Michael Kutz
Hey Dmitry,

to achieve parallel test execution, you should have a look into the Surefire or Failsafe plugin configuration options for forking and parallel execution.


You'll notice they are pretty much the same.

Kind regards,
Micha

Dmitry Senkovich <[hidden email]> schrieb am Mo., 20. Feb. 2017 um 17:03 Uhr:
Hi Michael,

I'm working with Maven and Spock, my E2E tests need to be parallized as it run too long. Could please provide configuration that enabled you to run Spock tests concurrently?

Thank you.


On Friday, March 13, 2015 at 7:27:15 PM UTC+3, Michael Kutz wrote:

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

John Allen <[hidden email]> 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?
  1. Follow instructions at http://mrhaki.blogspot.com/2011/01/spocklight-add-spock-support-to-java.html (updating version numbers).
  2. Convert Java project to Groovy project.  Can Jenkins run Groovy project JUnit and Spock tests?
  3. Create new Spock packages.  Or can I put them into folders that already have JUnit tests?
  4. 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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

kriegaex
> to achieve parallel test execution, you should have a look into the
> Surefire or Failsafe plugin configuration options for forking and parallel
> execution.

And they should be because Failsafe is almost 100% identical to surefire, AFAIK always based on its sourcecode and always released in the same version, with only a few slight differences.
--
Alexander Kriegisch
https://scrum-master.de

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to add Spock tests to existing Maven build with Java unit tests?

kriegaex
In reply to this post by Michael Kutz
>> to achieve parallel test execution, you should have a look into the
>> Surefire or Failsafe plugin configuration options for forking and parallel
>> execution.

And here I accidentally deleted the very part of the quote necessary to understand my remark:

>> You'll notice they are pretty much the same.

> And they should be because Failsafe is almost 100% identical to surefire, AFAIK
> always based on its sourcecode and always released in the same version, with
> only a few slight differences.
> --
> Alexander Kriegisch
> https://scrum-master.de

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.