title: Build failed with an exception. java.lang.AssertionError while passing parameter to Gradle
body: <p>I have a question about passing a parameter to the gradle build script.
  First of all I have a selenium test class:</p>
  
  <pre><code>public class TestHH extends HHTest{
  
      @Parameters({ "platform", "browser", "version"})
      @BeforeTest(alwaysRun = true)
      public void setup(String platform, String browser, String url, String version) throws MalformedURLException {
          DesiredCapabilities caps = new DesiredCapabilities();
          caps.setPlatform(org.openqa.selenium.Platform.WIN10);
          System.setProperty("java.net.preferIPv4stack", "true");
          caps.setCapability("SeleniumTests", "redhat5 &amp;&amp; amd64");
  
          assertEquals(System.getProperty(url), url);
  
          if (browser.equalsIgnoreCase("firefox")) {
              System.out.println("Executing on Firefox");
              String Hub = "http://localhost:4444/wd/hub";
  
              caps = DesiredCapabilities.firefox();
              caps.setBrowserName("firefox");
  
              System.setProperty("webdriver.gecko.driver", "/opt/geckodriver.exe");
  
              driver = new RemoteWebDriver(new URL(Hub), caps);
  
              driver.navigate().to(url);
              driver.manage().window().maximize();
  
          } else if (browser.equalsIgnoreCase("chrome")) {
              System.out.println("Executing on Chrome");
              String Hub = "http://localhost:4444/wd/hub";
  
              caps = DesiredCapabilities.chrome();
              caps.setBrowserName("chrome");
              ChromeOptions options = new ChromeOptions();
              System.setProperty("webdriver.chrome.driver", "/opt/chromedriver.exe");
              caps.setCapability(ChromeOptions.CAPABILITY, options);
  
              options.addArguments("--start-maximized");
              driver = new RemoteWebDriver(new URL(Hub), caps);
              driver.navigate().to(url);
          } else {
              throw new IllegalArgumentException("The Browser Type is undefined");
          }
      }
  </code></pre>
  
  <p>This is my build.gradle script:</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'eclipse'
  
  
  jar {
      version  '1.0'
      baseName 'SeleniumStarter'
      extension '.jar'
  }
  
  sourceCompatibility = 1.8
  targetCompatibility = 1.8
  
  
  description = ""
  
  repositories {
  
      mavenCentral()
      mavenLocal() 
  }
  
  ext.seleniumVersion = '3.7.1'
  
  dependencies {
      compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:seleniumVersion
      compile group: 'org.seleniumhq.selenium', name: 'selenium-server', version:seleniumVersion
      compile group: 'org.seleniumhq.selenium', name: 'selenium-edge-driver', version:seleniumVersion
      compile group: 'org.seleniumhq.selenium', name: 'selenium-firefox-driver', version:seleniumVersion
      compile group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version:seleniumVersion
      compile group: 'org.seleniumhq.selenium', name: 'selenium-api', version:seleniumVersion
      compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:seleniumVersion
  
      compile group: 'org.uncommons', name: 'reportng', version:'1.1.4'
      testCompile group: 'junit', name: 'junit', version:'4.12'
      testCompile group: 'org.testng', name: 'testng', version:'6.11'
  }
  
  test {
  
      systemProperties(System.getProperties())
       println 'test'
       println System.properties['url'] // print for testing purposes 
  
       systemProperty 'url', System.getProperty('url')
       useTestNG() {
         suites 'src/test/resources/TestHH.xml'
  
       }
  
   }
  
  eclipse {
    classpath {
    containers 'org.springsource.ide.eclipse.gradle.classpathcontainer'}
  }
  
  // A custom task to show report on tests that have run
  task viewResults(dependsOn: ['test'] , type:Exec) {
          workingDir './build/reports/tests'      
          commandLine 'cmd', '/c', 'start index.html' 
  }
  
  task wrapper(type: Wrapper) {
      gradleVersion = '2.10' //we want gradle 2.10 to run this project
  }
  
  task logInfo (dependsOn: test){
      logging.captureStandardOutput LogLevel.INFO
      doLast {
  
          println 'test'
          println System.properties['url']
          println 'url'
  
  
  
      }
  
  }
  </code></pre>
  
  <p>The parameter which I'm trying to pass by using gradle command is an url.
  I'm passing other parameters like platform, browser, version by using the testng xml file. </p>
  
  <p>I start the following command to pass the required parameter but it doesn't work.</p>
  
  <pre><code>  gradle test -Durl="http://live-test1.hamburg.de"
  </code></pre>
  
  <p>It launches Firefox and Chrome without any url.</p>
  
  <p>I'm getting this output with an exception after I've started the above command :</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  java.lang.AssertionError
  </code></pre>