title: How do I wrap a gradle task in another task?
body: <p>I am trying to configure two different gradle test tasks that essentially just set some values and then run the built-in test task. I have read the gradle documentation and have been searching for a few hours with no luck. I'm guessing I just don't know how to word this question properly to find anything.</p>
  
  <p>The scenario is that we have selenium tests that we might want to run locally or remotely. If we run them locally we want to configure how many threads it uses, and if we run them remotely we want to set a much higher number of threads and also a system property so that the test runner knows to run remotely.</p>
  
  <p>Essentially here's what I'd like to do:</p>
  
  <pre><code>task testLocal {
      maxParallelForks = 2
      // now run the built-in test task
  }
  
  task testRemote {
      maxParallelForks = 4
      systemProperties "geb.env": "winxp-firefox"
      // now run the built-in test task
  }
  </code></pre>
  
  <p>Ideally I'd also like to be able to pass all the same arguments that the test task supports on the command line, like:</p>
  
  <p><code>gradle testLocal --tests com.domain.tests.package*</code></p>
  
  <p>What is the proper way to handle this scenario with gradle?</p>