[GRADLE-2654] gradle can run tests from jars Created: 25/Jan/13  Updated: 12/Dec/16  Resolved: 12/Dec/16

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Duplicate Votes: 22

Issue Links:
Related
Related to GRADLE-863 Execute test suites in libs / differe... Resolved

 Description   

It might be useful for users to run tests from jars. Currently, the Test task looks for test classes in a directory.



 Comments   
Comment by Gradle Forums [ 25/Jan/13 ]

Sorry, this feature is not supported ATM. I'm curious, why do you keep test classes in the jar?

Comment by Gradle Forums [ 25/Jan/13 ]

I have a very large code base. Once built, I could move the build onto another machine with more computing power and run tests in parallel. Test and application code all are in jar files.

Current work around is to expand all test-jars in to a directory and use that directory to get tests from. This is redundant and tests are already in jars..

Comment by William Lichtenberger [ 15/Mar/13 ]

It's also useful when the tests are truly integration or system tests. I'm going to implement the work around of extracting and running the jars. Another alternative is to just run them from Ant, which supports this.

Comment by Per Lambæk [ 03/Sep/13 ]

Another vote for this feature. It could be really useful for our build pipeline, where we compile our integration tests together with everything else, and run them in a later stage of our pipeline..

Comment by Yannick Welsch [ 08/Sep/13 ]

I made a pull request (proposal) for this feature:

https://github.com/gradle/gradle/pull/194

Comment by Damien Coraboeuf [ 16/Apr/14 ]

This is indeed quite an important feature. In a continuous delivery pipeline, we want to be able to download binaries & deployment configurations from an artifact repository, deploy the application on a server, and run some tests. Those tests will be also packaged as JAR files, and the tests should be able to run using those JAR directly.

Of course, we can always revert back to ANT. But then, what's the point of using Gradle in the first place?

Damien.

Comment by Stewart Bryson [ 11/Nov/14 ]

I would like to do this as well. While waiting on Gradle to implement this feature, what are the ways around this for now? I see the "extract the jar..." option, but I also see that they can be run using Ant. My code is in Groovy... could I use the Groovy ANT functionality to do this?

Are the test classes still included in src/test/groovy|java to get them compiled in the jar file?

Comment by Damien Coraboeuf [ 12/Nov/14 ]

FYI, I've written an article about creating executable acceptance tests: https://nemerosa.ghost.io/2014/11/05/executable-acceptance-tests-using-spring-boot/ It's using Spring Boot, but I think this could be done using other technologies. This allows me to store the acceptance tests as an artifact and to run them all along my deployment pipeline.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Stalle [ 16/Nov/16 ]

+1, I still believe this is important, especially for integration tests. I'm currently converting a legacy bash+ant built application split over 20-50 subprojects where each subproject publishes integrations tests for itself and dependent modules. I haven't found a simple way to run the integration tests from the submodules in gradle.

Comment by Gerwin Jansen [ 30/Nov/16 ]

I also would like to see this fixed.

Comment by Matt Stave [ 01/Dec/16 ]

I too, would like to see this fixed.

Comment by Stalle [ 12/Dec/16 ]

I created https://github.com/gradle/gradle/issues/1007 for this

Generated at Wed Jun 30 12:27:48 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.