title: Gradle task check if property is defined
body: <p>I have a Gradle task that executes a TestNG test suite.
  I want to be able to pass a flag to the task in order to use a special TestNG XML suite file (or just use the default suite if the flag isn't set).</p>
  <pre class="lang-bash prettyprint-override"><code>gradle test
  </code></pre>
  <p>... should run the default standard suite of tests</p>
  <pre class="lang-bash prettyprint-override"><code>gradle test -Pspecial
  </code></pre>
  <p>... should run the special suite of tests</p>
  <p>I've been trying something like this:</p>
  <pre><code>test {
      if (special) {
          test(testng_special.xml);
      }
      else {
          test(testng_default.xml);
      }
  }
  </code></pre>
  <p>But I get a undefined property error. What is the correct way to go about this?</p>