title: Gradle to run tests from "test" dependency jars
body: <p>Anyone able to run tests from "test" dependency jars in gradle build?
  I have a gradle build script which includes few test-jars as well under testRuntime dependency. I would like to run the tests in these dependencies using "gradle test".</p>
  
  <p>I see that gradle does not have out-of-box solution to run tests from a jar as mentioned in <a href="https://stackoverflow.com/questions/14123350/gradle-junit-runs-how-to-pick-tests-from-jar-file">this link</a>. I am trying to follow the "unpack" option suggested in this post.
  Am not sure how do I tie the unpack task with test task to iterate over all the test-jar dependencies and run the tests?
  PS: I know that we do not have to run tests of dependencies in consuming projects. But for my reasons, I have to do this.</p>
  
  <p>Any gradle experts on how to achieve this?</p>
  
  <p>[EDIT]<br>
  I used the below to code to run tests from a jar. But what I want is a generic task such as "runTestsFromDependencyJars" which goes through all the test configuration dependencies and run the test. Not sure how do I get it to run for all such dependencies?</p>
  
  <pre><code>    task unzip(type: Copy )  {
          from zipTree(file('jar file with absolute path'))
          into file("$temporaryDir/")
      }
  
      task testFromJar(type: Test , dependsOn: unzip) {
          doFirst {
              testClassesDir=file("$temporaryDir/../unzip/")
              classpath=files(testClassesDir)+sourceSets.main.compileClasspath+sourceSets.test.compileClasspath
          }
      }
  </code></pre>