Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7013673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:25:18+00:00 2026-05-27T22:25:18+00:00

Does anyone know how to run the tests from a different gradle project and

  • 0

Does anyone know how to run the tests from a different gradle project and still get emma coverage reporting data?

Here is my current layout:

Root/
  settings.gradle (no explicit build.gradle - just defines all subprojects)
  SubProjectA/
    build.gradle
    src/ (all real source is here)
  SubProjectATest/
    build.gradle
    src/ (all testing code is here)
  SubProjectB/ (similar structure as A)
  SubProjectBTest/ (similar structure as ATest)

I am currently using the emma plugin, and I would like to build SubProjectA and run all the tests in SubProjectATest from within the build.gradle of SubProjectA.

Here are some things I tried inside the build.gradle of SubProjectA

  1. testCompile project(':SubProjectATest').sourceSets.test.classes (as suggested by this article), but I got an error “Could not find property 'sourceSets' on project“
  2. Just the straight-up testCompile project(':SubProjectATest'), but then I get “..SubProjectA/build/classes/test', not found” and also “Skipping task ‘:SubProjectA:compileTestJava' as it has no source files.“
  3. Simply adding a sourceSet like the following:

    test {
    java {
    srcDir ‘../SubProjectATest/src’
    }
    }

Adding the source set in (option 3) is the only option that worked, but it seems sloppy to do it this way. Does anyone know how to do this using project dependencies?

Update #1
I also tried one of the answers below to use test.dependsOn and the tests do run, but the emma plugin reported the following: build/classes/test', not found

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:25:18+00:00Added an answer on May 27, 2026 at 10:25 pm

    1. and 2. just add classes to the test compile class path. This doesn’t have any effect on which tests are going to be executed.

    3. is the wrong approach because you should not add sources from project X to project Y.

    If what you want is that gradle :SubProjectA:test also executes :SubProjectATest:test, all you need to do is to add a task dependency:

    SubProjectA/build.gradle:

    test.dependsOn(":subProjectATest:test")
    

    By the way, what is your motivation for putting the tests in a separate project?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

By default nunit tests run alphabetically. Does anyone know of any way to set
Does anyone know if it's possible to get a Win32 application to run under
Does anyone know how to connect DB from Selenium RC? I need to run
Does anyone know about a good SUDS tutorial. I am trying to run tests
Does anyone know how I'd run plain text passwords through the authlogic hasing algorithm
Does anyone know a good tool that can be run on a page (for
Does anyone know of a good way to automatically run certain file types through
Does anyone know of a library that enables you to run an application inside
Does anyone know of a similar product to Citrix Server that'll run on the
Does anyone know what error message will be displayed when someone tries to run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.