org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

prasanth kotagiri
Hi,

Here is my code

package YatraBooking;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;

public class YatraBookingValidation {
public WebDriver driver;
  @Test
  public void f() {
 
 driver.findElement(By.xpath("//*[@id='BE_Nav']/li[2]/a/span")).click();
 
  }
  @BeforeClass
  @Parameters("browser")
  public void beforeclass(String browser) throws Exception {
 
 
 
  if(browser.equalsIgnoreCase("firefox")){
 
       //create firefox instance
 
           driver = new FirefoxDriver();
 
       }
 
//Check if parameter passed as 'chrome'
 
       else if(browser.equalsIgnoreCase("chrome")){
 
           //set path to chromedriver.exe You may need to download it from http://code.google.com/p/selenium/wiki/ChromeDriver
 
           System.setProperty("webdriver.chrome.driver","E:\\Data\\Prasanth\\Library\\chromedriver_win32\\chromedriver.exe");
 
           //create chrome instance
 
           driver = new ChromeDriver();
 
       }
  driver.get("http://yatra.com");
  Thread.sleep(3000);
 }
 
  

  @AfterClass
  public void afterClass() {
  }

}


Testng.xml:


<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite" parallel="tests">
  <test name="FirefoxTest">
  <parameter name="browser" value="Firefox"/>
    <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  </test> <!-- Test -->
  
  <test name="ChromeTest">
  <parameter name="browser" value="Chrome"/>
  <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  
  </test>
</suite> <!-- Suite -->


Here is my problem when i run the test from testng.xml the test is running fine and passed.

When i run the same test from POM.xml in MAVEN project it is throwing the following error like:

org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Please provide me the suggestion ASAP

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Krishnan Mahadevan
I cant recreate this problem.
Please show us the complete stacktrace of the failure when you run your tests from command prompt.

Also please show us how does your surefire plugin configuration look like in your pom file.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Oct 29, 2015 at 2:53 PM, prasanth kotagiri <[hidden email]> wrote:
Hi,

Here is my code

package YatraBooking;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;

public class YatraBookingValidation {
public WebDriver driver;
  @Test
  public void f() {
 
 driver.findElement(By.xpath("//*[@id='BE_Nav']/li[2]/a/span")).click();
 
  }
  @BeforeClass
  @Parameters("browser")
  public void beforeclass(String browser) throws Exception {
 
 
 
  if(browser.equalsIgnoreCase("firefox")){
 
       //create firefox instance
 
           driver = new FirefoxDriver();
 
       }
 
//Check if parameter passed as 'chrome'
 
       else if(browser.equalsIgnoreCase("chrome")){
 
           //set path to chromedriver.exe You may need to download it from http://code.google.com/p/selenium/wiki/ChromeDriver
 
           System.setProperty("webdriver.chrome.driver","E:\\Data\\Prasanth\\Library\\chromedriver_win32\\chromedriver.exe");
 
           //create chrome instance
 
           driver = new ChromeDriver();
 
       }
  driver.get("http://yatra.com");
  Thread.sleep(3000);
 }
 
  

  @AfterClass
  public void afterClass() {
  }

}


Testng.xml:


<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite" parallel="tests">
  <test name="FirefoxTest">
  <parameter name="browser" value="Firefox"/>
    <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  </test> <!-- Test -->
  
  <test name="ChromeTest">
  <parameter name="browser" value="Chrome"/>
  <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  
  </test>
</suite> <!-- Suite -->


Here is my problem when i run the test from testng.xml the test is running fine and passed.

When i run the same test from POM.xml in MAVEN project it is throwing the following error like:

org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Please provide me the suggestion ASAP

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

prasanth kotagiri
Hi Krishnan,

POM File:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Garudah</groupId>
  <artifactId>Yatra</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <dependencies>
  <dependency>
  <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.48.2</version>
  </dependency>
  <dependency>
  <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.48.2</version>
  </dependency>
  <dependency>
  <groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.6</version>
  </dependency>
  <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.44.0</version>
</dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.19</version>
          <configuration>
          
          <includes>
          <include>YatraBookingValidation.java</include>
          </includes>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  
</project>

My Complete Stack Trace:

Please find the attachment of report..

On Thursday, October 29, 2015 at 8:51:25 PM UTC+5:30, Krishnan wrote:
I cant recreate this problem.
Please show us the complete stacktrace of the failure when you run your tests from command prompt.

Also please show us how does your surefire plugin configuration look like in your pom file.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Thu, Oct 29, 2015 at 2:53 PM, prasanth kotagiri <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="FON2ExY9DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">prasan...@...> wrote:
Hi,

Here is my code

package YatraBooking;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import <a href="http://org.openqa.selenium.by/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.by%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNH3N8mrMHhLr8Y42yXGfsGSRJHkww&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.by%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNH3N8mrMHhLr8Y42yXGfsGSRJHkww&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;

public class YatraBookingValidation {
public WebDriver driver;
  @Test
  public void f() {
 
 driver.findElement(By.xpath("//*[@id='BE_Nav']/li[2]/a/span")).click();
 
  }
  @BeforeClass
  @Parameters("browser")
  public void beforeclass(String browser) throws Exception {
 
 
 
  if(browser.equalsIgnoreCase("firefox")){
 
       //create firefox instance
 
           driver = new FirefoxDriver();
 
       }
 
//Check if parameter passed as 'chrome'
 
       else if(browser.equalsIgnoreCase("chrome")){
 
           //set path to chromedriver.exe You may need to download it from <a href="http://code.google.com/p/selenium/wiki/ChromeDriver" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://code.google.com/p/selenium/wiki/ChromeDriver&#39;;return true;" onclick="this.href=&#39;http://code.google.com/p/selenium/wiki/ChromeDriver&#39;;return true;">http://code.google.com/p/selenium/wiki/ChromeDriver
 
           System.setProperty("webdriver.chrome.driver","E:\\Data\\Prasanth\\Library\\chromedriver_win32\\chromedriver.exe");
 
           //create chrome instance
 
           driver = new ChromeDriver();
 
       }
  driver.get("<a href="http://yatra.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fyatra.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFMMcI4XemRQNxZMWILyR8OYKJNow&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fyatra.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFMMcI4XemRQNxZMWILyR8OYKJNow&#39;;return true;">http://yatra.com");
  Thread.sleep(3000);
 }
 
  

  @AfterClass
  public void afterClass() {
  }

}


Testng.xml:


<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite" parallel="tests">
  <test name="FirefoxTest">
  <parameter name="browser" value="Firefox"/>
    <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  </test> <!-- Test -->
  
  <test name="ChromeTest">
  <parameter name="browser" value="Chrome"/>
  <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  
  </test>
</suite> <!-- Suite -->


Here is my problem when i run the test from testng.xml the test is running fine and passed.

When i run the same test from POM.xml in MAVEN project it is throwing the following error like:

org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Please provide me the suggestion ASAP

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FON2ExY9DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FON2ExY9DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/testng-users&#39;;return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

emailable-report.html (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Krishnan Mahadevan
You aren't even using the TestNG suite xml file that you created.

You are directly using the class name in your surefire plugin section

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19</version>
        <configuration>
        <includes>
          <include>YatraBookingValidation.java</include>
        </includes>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>
</build>



Change this such that the plugin refers to your suite xml file (you should find samples of how to do it on the surefire plugin documentation site )


On a side note, for the below problem
java.lang.RuntimeException: Process refused to die after 10 seconds, and couldn't taskkill it: Unable to find executable for: taskkill at org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:142) at org.openqa.selenium.os.ProcessUtils.killProcess(ProcessUtils.java:81) at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.destroyHarder(UnixProcess.java:247) at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$2(UnixProcess.java:246) at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:125) at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:155) at org.openqa.selenium.firefox.FirefoxBinary.quit(FirefoxBinary.java:259) at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.quit(NewProfileExtensionConnection.java:204) at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.quit(FirefoxDriver.java:364) at org.openqa.selenium.firefox.FirefoxDriver.stopClient(FirefoxDriver.java:310) at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:519) at YatraBooking.YatraBookingValidation.afterClass(YatraBookingValidation.java:59)

Check if you have somewhere altered the PATH variable. 
On windows "taskkill" is expected to be found very easily. This normally comes up when you have altered the PATH variable and overwritten it with some random stuff.







Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Fri, Oct 30, 2015 at 12:08 PM, prasanth kotagiri <[hidden email]> wrote:
Hi Krishnan,

POM File:

  <modelVersion>4.0.0</modelVersion>
  <groupId>Garudah</groupId>
  <artifactId>Yatra</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <dependencies>
  <dependency>
  <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.48.2</version>
  </dependency>
  <dependency>
  <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.48.2</version>
  </dependency>
  <dependency>
  <groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.6</version>
  </dependency>
  <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.44.0</version>
</dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.19</version>
          <configuration>
          
          <includes>
          <include>YatraBookingValidation.java</include>
          </includes>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  
</project>

My Complete Stack Trace:

Please find the attachment of report..

On Thursday, October 29, 2015 at 8:51:25 PM UTC+5:30, Krishnan wrote:
I cant recreate this problem.
Please show us the complete stacktrace of the failure when you run your tests from command prompt.

Also please show us how does your surefire plugin configuration look like in your pom file.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Oct 29, 2015 at 2:53 PM, prasanth kotagiri <[hidden email]> wrote:
Hi,

Here is my code

package YatraBooking;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;

public class YatraBookingValidation {
public WebDriver driver;
  @Test
  public void f() {
 
 driver.findElement(By.xpath("//*[@id='BE_Nav']/li[2]/a/span")).click();
 
  }
  @BeforeClass
  @Parameters("browser")
  public void beforeclass(String browser) throws Exception {
 
 
 
  if(browser.equalsIgnoreCase("firefox")){
 
       //create firefox instance
 
           driver = new FirefoxDriver();
 
       }
 
//Check if parameter passed as 'chrome'
 
       else if(browser.equalsIgnoreCase("chrome")){
 
           //set path to chromedriver.exe You may need to download it from http://code.google.com/p/selenium/wiki/ChromeDriver
 
           System.setProperty("webdriver.chrome.driver","E:\\Data\\Prasanth\\Library\\chromedriver_win32\\chromedriver.exe");
 
           //create chrome instance
 
           driver = new ChromeDriver();
 
       }
  driver.get("http://yatra.com");
  Thread.sleep(3000);
 }
 
  

  @AfterClass
  public void afterClass() {
  }

}


Testng.xml:


<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite" parallel="tests">
  <test name="FirefoxTest">
  <parameter name="browser" value="Firefox"/>
    <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  </test> <!-- Test -->
  
  <test name="ChromeTest">
  <parameter name="browser" value="Chrome"/>
  <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  
  </test>
</suite> <!-- Suite -->


Here is my problem when i run the test from testng.xml the test is running fine and passed.

When i run the same test from POM.xml in MAVEN project it is throwing the following error like:

org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Please provide me the suggestion ASAP

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

kishore ramineni
In reply to this post by prasanth kotagiri
Hi ,

I found alternative way to pass parameters.

By specifying the parameter values from sure-fire plug-in:  i have specified as follows

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <systemProperties>
            <property>
              <name>browserType</name>
              <value>firefox</value>
            </property>
            <property>
              <name>appUrl</name>
              <value>https://www.expedia.com.au/</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>

instead of @parameters i have used  them sure-fire plugin with name and values pair.

But still i am not sure why it's not considering parameters from testng.xml. have to figure out that.

--Thanks,
kishore



On Friday, 30 October 2015 01:29:44 UTC+11, prasanth kotagiri wrote:
Hi,

Here is my code

package YatraBooking;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import <a href="http://org.openqa.selenium.by/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.by%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH3N8mrMHhLr8Y42yXGfsGSRJHkww&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.by%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH3N8mrMHhLr8Y42yXGfsGSRJHkww&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;

public class YatraBookingValidation {
public WebDriver driver;
  @Test
  public void f() {
 
 driver.findElement(By.xpath("//*[@id='BE_Nav']/li[2]/a/span")).click();
 
  }
  @BeforeClass
  @Parameters("browser")
  public void beforeclass(String browser) throws Exception {
 
 
 
  if(browser.equalsIgnoreCase("firefox")){
 
       //create firefox instance
 
           driver = new FirefoxDriver();
 
       }
 
//Check if parameter passed as 'chrome'
 
       else if(browser.equalsIgnoreCase("chrome")){
 
           //set path to chromedriver.exe You may need to download it from <a href="http://code.google.com/p/selenium/wiki/ChromeDriver" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://code.google.com/p/selenium/wiki/ChromeDriver&#39;;return true;" onclick="this.href=&#39;http://code.google.com/p/selenium/wiki/ChromeDriver&#39;;return true;">http://code.google.com/p/selenium/wiki/ChromeDriver
 
           System.setProperty("webdriver.chrome.driver","E:\\Data\\Prasanth\\Library\\chromedriver_win32\\chromedriver.exe");
 
           //create chrome instance
 
           driver = new ChromeDriver();
 
       }
  driver.get("<a href="http://yatra.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fyatra.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFMMcI4XemRQNxZMWILyR8OYKJNow&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fyatra.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFMMcI4XemRQNxZMWILyR8OYKJNow&#39;;return true;">http://yatra.com");
  Thread.sleep(3000);
 }
 
  

  @AfterClass
  public void afterClass() {
  }

}


Testng.xml:


<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite" parallel="tests">
  <test name="FirefoxTest">
  <parameter name="browser" value="Firefox"/>
    <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  </test> <!-- Test -->
  
  <test name="ChromeTest">
  <parameter name="browser" value="Chrome"/>
  <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  
  </test>
</suite> <!-- Suite -->


Here is my problem when i run the test from testng.xml the test is running fine and passed.

When i run the same test from POM.xml in MAVEN project it is throwing the following error like:

org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Please provide me the suggestion ASAP

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Krishnan Mahadevan
Kishore,

I can't recreate your problem. I am able to run a suite xml file which has parameters defined in it using Maven.

Here's sample :

public class ParamsDemo {
@BeforeClass
@Parameters ("value")
public void beforeClass(int value) {
System.err.println("Value passed was : " + value);
}

@Test
public void testMethod() {
System.err.println("Hello world");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Class1Suite" parallel="false">
<test name="Class1Test">
<parameter name="value" value="420"/>
<classes>
<class name="organized.chaos.forums.ParamsDemo"/>
</classes>
</test> <!-- Class1Test -->
</suite> <!-- Class1Suite -->
Surefire plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<suiteXmlFiles>${file}
<suiteXmlFile>${folder}/${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
<skipTests>false</skipTests>
</configuration>
</plugin>

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
[XmlSuite] [WARN] 'parallel' value 'false' is deprecated, default value will be used instead: 'none'.
Value passed was : 420
Hello world
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.474 sec - in TestSuite

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------






Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Sat, Apr 30, 2016 at 5:59 PM, kishore ramineni <[hidden email]> wrote:
Hi ,

I found alternative way to pass parameters.

By specifying the parameter values from sure-fire plug-in:  i have specified as follows

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <systemProperties>
            <property>
              <name>browserType</name>
              <value>firefox</value>
            </property>
            <property>
              <name>appUrl</name>
              <value>https://www.expedia.com.au/</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>

instead of @parameters i have used  them sure-fire plugin with name and values pair.

But still i am not sure why it's not considering parameters from testng.xml. have to figure out that.

--Thanks,
kishore



On Friday, 30 October 2015 01:29:44 UTC+11, prasanth kotagiri wrote:
Hi,

Here is my code

package YatraBooking;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;

public class YatraBookingValidation {
public WebDriver driver;
  @Test
  public void f() {
 
 driver.findElement(By.xpath("//*[@id='BE_Nav']/li[2]/a/span")).click();
 
  }
  @BeforeClass
  @Parameters("browser")
  public void beforeclass(String browser) throws Exception {
 
 
 
  if(browser.equalsIgnoreCase("firefox")){
 
       //create firefox instance
 
           driver = new FirefoxDriver();
 
       }
 
//Check if parameter passed as 'chrome'
 
       else if(browser.equalsIgnoreCase("chrome")){
 
           //set path to chromedriver.exe You may need to download it from http://code.google.com/p/selenium/wiki/ChromeDriver
 
           System.setProperty("webdriver.chrome.driver","E:\\Data\\Prasanth\\Library\\chromedriver_win32\\chromedriver.exe");
 
           //create chrome instance
 
           driver = new ChromeDriver();
 
       }
  driver.get("http://yatra.com");
  Thread.sleep(3000);
 }
 
  

  @AfterClass
  public void afterClass() {
  }

}


Testng.xml:


<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite" parallel="tests">
  <test name="FirefoxTest">
  <parameter name="browser" value="Firefox"/>
    <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  </test> <!-- Test -->
  
  <test name="ChromeTest">
  <parameter name="browser" value="Chrome"/>
  <classes>
      <class name="YatraBooking.YatraBookingValidation"/>
    </classes>
  
  </test>
</suite> <!-- Suite -->


Here is my problem when i run the test from testng.xml the test is running fine and passed.

When i run the same test from POM.xml in MAVEN project it is throwing the following error like:

org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Please provide me the suggestion ASAP

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Vinoth Kumar
In reply to this post by prasanth kotagiri
I am also facing the same problem, can anyone please help me, find here my code below.

package ParallelTest;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class SampleParalleltest {
WebDriver driver;
String baseUrl, NodeUrl;
@BeforeTest
@Parameters ({"platform", "browserName", "remoteurl"})
public void setUp(String platform , String browserName, String remoteurl) throws MalformedURLException{
baseUrl = "http://youtube.com";
DesiredCapabilities capability = null;
if(browserName.equals("chrome")) {
capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
System.out.println("Browser Name is Chrome!" );
} else {
System.out.println("Invalid Browser Name");
}
 
capability.setPlatform(Platform.WIN10);
capability.setVersion("54.0");
capability.setCapability(FirefoxDriver.MARIONETTE, true);
driver = new RemoteWebDriver (new URL (remoteurl), capability);
}
@Test 
public void OpenUrl(){
driver.get(baseUrl);
driver.findElement(By.id("masthead-search-term")).sendKeys("pwrdby");
driver.findElement(By.id("masthead-search-term")).sendKeys(Keys.ENTER);
System.out.println("You opened Google.com on differnt system, and your tEST IS FINE!!");
}

}
*************************
Testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" thread-count ="1" parallel = "test">
  <test verbose="2" name="WIN10">
  <parameters>
<parameter name ="platform" value = "WIN10"/>
<parameter name ="browserName" value = "chrome" />
<parameter name ="remoteurl" value = "http://192.168.1.117:5568/wd/hub" />
</parameters>
    <classes>
      <class name="ParallelTest.SampleParalleltest">
      <methods>
<include name = "OpenUrl" />  <!-- Name of the TESTS -->
</methods>
</class>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

Error which i got while running!

[TestNG] Running:
  C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

[Utils] Attempting to create D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite\Default test.xml
[Utils]   Directory D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite exists: true
FAILED CONFIGURATION: @BeforeTest setUp
org.testng.TestNGException: 
Parameter 'platform' is required by @Configuration on method setUp but has not been marked @Optional or defined
in C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

I will be happy if anyone could help out on this. thanks in advance!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

customerquick
Hi, did you find any solution for this problem? i have the same(( and cant find the solution

On Thursday, December 1, 2016 at 8:00:34 PM UTC+2, Vinoth Kumar wrote:
I am also facing the same problem, can anyone please help me, find here my code below.

package ParallelTest;

import java.net.MalformedURLException;
import java.net.URL;

import <a href="http://org.openqa.selenium.By" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class SampleParalleltest {
WebDriver driver;
String baseUrl, NodeUrl;
@BeforeTest
@Parameters ({"platform", "browserName", "remoteurl"})
public void setUp(String platform , String browserName, String remoteurl) throws MalformedURLException{
baseUrl = "<a href="http://youtube.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://youtube.com&#39;;return true;" onclick="this.href=&#39;http://youtube.com&#39;;return true;">http://youtube.com";
DesiredCapabilities capability = null;
if(browserName.equals("chrome")) {
capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
System.out.println("Browser Name is Chrome!" );
} else {
System.out.println("Invalid Browser Name");
}
 
capability.setPlatform(Platform.WIN10);
capability.setVersion("54.0");
capability.setCapability(FirefoxDriver.MARIONETTE, true);
driver = new RemoteWebDriver (new URL (remoteurl), capability);
}
@Test 
public void OpenUrl(){
driver.get(baseUrl);
driver.findElement(By.id("masthead-search-term")).sendKeys("pwrdby");
driver.findElement(By.id("masthead-search-term")).sendKeys(Keys.ENTER);
System.out.println("You opened Google.com on differnt system, and your tEST IS FINE!!");
}

}
*************************
Testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">http://testng.org/testng-1.0.dtd">
<suite name="Suite" thread-count ="1" parallel = "test">
  <test verbose="2" name="WIN10">
  <parameters>
<parameter name ="platform" value = "WIN10"/>
<parameter name ="browserName" value = "chrome" />
<parameter name ="remoteurl" value = "<a href="http://192.168.1.117:5568/wd/hub" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.117%3A5568%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS7ngK0CpgFnSDTZxeU_BYqrmY2Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.117%3A5568%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS7ngK0CpgFnSDTZxeU_BYqrmY2Q&#39;;return true;">http://192.168.1.117:5568/wd/hub" />
</parameters>
    <classes>
      <class name="ParallelTest.SampleParalleltest">
      <methods>
<include name = "OpenUrl" />  <!-- Name of the TESTS -->
</methods>
</class>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

Error which i got while running!

[TestNG] Running:
  C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

[Utils] Attempting to create D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite\Default test.xml
[Utils]   Directory D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite exists: true
FAILED CONFIGURATION: @BeforeTest setUp
org.testng.TestNGException: 
Parameter 'platform' is required by @Configuration on method setUp but has not been marked @Optional or defined
in C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

I will be happy if anyone could help out on this. thanks in advance!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Krishnan Mahadevan

How are you running your test ? Am hoping you are running it from within the IDE by right clicking on the corresponding suite xml file and NOT by right clicking on the corresponding TestNG test class.

If the above still doesn't resolve your issue please make sure you include the following :

1. TestNG version (please use 6.11 which is the latest released version )
2. Sample test code which can be used to recreate the problem ( please trim it to a simple one which doesn't use any selenium etc )
3. How are you running it ? Via IDE (which IDE?) or via a build tool (Gradle/ant/maven) or via command prompt (using Java command)


On Sat, Jul 15, 2017, 01:05 <[hidden email]> wrote:
Hi, did you find any solution for this problem? i have the same(( and cant find the solution


On Thursday, December 1, 2016 at 8:00:34 PM UTC+2, Vinoth Kumar wrote:
I am also facing the same problem, can anyone please help me, find here my code below.

package ParallelTest;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.Keys;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class SampleParalleltest {
WebDriver driver;
String baseUrl, NodeUrl;
@BeforeTest
@Parameters ({"platform", "browserName", "remoteurl"})
public void setUp(String platform , String browserName, String remoteurl) throws MalformedURLException{
baseUrl = "http://youtube.com";
DesiredCapabilities capability = null;
if(browserName.equals("chrome")) {
capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
System.out.println("Browser Name is Chrome!" );
} else {
System.out.println("Invalid Browser Name");
}
 
capability.setPlatform(Platform.WIN10);
capability.setVersion("54.0");
capability.setCapability(FirefoxDriver.MARIONETTE, true);
driver = new RemoteWebDriver (new URL (remoteurl), capability);
}
@Test 
public void OpenUrl(){
driver.get(baseUrl);
driver.findElement(By.id("masthead-search-term")).sendKeys("pwrdby");
driver.findElement(By.id("masthead-search-term")).sendKeys(Keys.ENTER);
System.out.println("You opened Google.com on differnt system, and your tEST IS FINE!!");
}

}
*************************
Testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" thread-count ="1" parallel = "test">
  <test verbose="2" name="WIN10">
  <parameters>
<parameter name ="platform" value = "WIN10"/>
<parameter name ="browserName" value = "chrome" />
<parameter name ="remoteurl" value = "http://192.168.1.117:5568/wd/hub" />
</parameters>
    <classes>
      <class name="ParallelTest.SampleParalleltest">
      <methods>
<include name = "OpenUrl" />  <!-- Name of the TESTS -->
</methods>
</class>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

Error which i got while running!

[TestNG] Running:
  C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

[Utils] Attempting to create D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite\Default test.xml
[Utils]   Directory D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite exists: true
FAILED CONFIGURATION: @BeforeTest setUp
org.testng.TestNGException: 
Parameter 'platform' is required by @Configuration on method setUp but has not been marked @Optional or defined
in C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

I will be happy if anyone could help out on this. thanks in advance!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

80Vikram
Hi Krishnan,

I'm also facing same issue when I've below setup

 
    @BeforeSuite
    @Parameters({ "appName_" })
    public synchronized void setupMethod()

It works well in below case though

    @BeforeTest(alwaysRun = true)
    @Parameters({ "appName_" })
    public synchronized void setupMethod

My requirement is that I need to run multiple test classes in parallel but want to call @BeforeSuite in only 1st test class which does the setup.

Please clarify.

Thanks & Regards,
Vikram

On Monday, July 17, 2017 at 7:34:06 AM UTC+2, Krishnan wrote:

How are you running your test ? Am hoping you are running it from within the IDE by right clicking on the corresponding suite xml file and NOT by right clicking on the corresponding TestNG test class.

If the above still doesn't resolve your issue please make sure you include the following :

1. TestNG version (please use 6.11 which is the latest released version )
2. Sample test code which can be used to recreate the problem ( please trim it to a simple one which doesn't use any selenium etc )
3. How are you running it ? Via IDE (which IDE?) or via a build tool (Gradle/ant/maven) or via command prompt (using Java command)


On Sat, Jul 15, 2017, 01:05 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="KL7k-wsoBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">custom...@...> wrote:
Hi, did you find any solution for this problem? i have the same(( and cant find the solution


On Thursday, December 1, 2016 at 8:00:34 PM UTC+2, Vinoth Kumar wrote:
I am also facing the same problem, can anyone please help me, find here my code below.

package ParallelTest;

import <a href="http://java.net" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjava.net\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjava.net\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;">java.net.MalformedURLException;
import java.net.URL;

import <a href="http://org.openqa.selenium.By" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class SampleParalleltest {
WebDriver driver;
String baseUrl, NodeUrl;
@BeforeTest
@Parameters ({"platform", "browserName", "remoteurl"})
public void setUp(String platform , String browserName, String remoteurl) throws MalformedURLException{
baseUrl = "<a href="http://youtube.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://youtube.com&#39;;return true;" onclick="this.href=&#39;http://youtube.com&#39;;return true;">http://youtube.com";
DesiredCapabilities capability = null;
if(browserName.equals("chrome")) {
capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
System.out.println("Browser Name is Chrome!" );
} else {
System.out.println("Invalid Browser Name");
}
 
capability.setPlatform(Platform.WIN10);
capability.setVersion("54.0");
capability.setCapability(FirefoxDriver.MARIONETTE, true);
driver = new RemoteWebDriver (new URL (remoteurl), capability);
}
@Test 
public void OpenUrl(){
driver.get(baseUrl);
driver.findElement(By.id("masthead-search-term")).sendKeys("pwrdby");
driver.findElement(By.id("masthead-search-term")).sendKeys(Keys.ENTER);
System.out.println("You opened Google.com on differnt system, and your tEST IS FINE!!");
}

}
*************************
Testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">http://testng.org/testng-1.0.dtd">
<suite name="Suite" thread-count ="1" parallel = "test">
  <test verbose="2" name="WIN10">
  <parameters>
<parameter name ="platform" value = "WIN10"/>
<parameter name ="browserName" value = "chrome" />
<parameter name ="remoteurl" value = "<a href="http://192.168.1.117:5568/wd/hub" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.117%3A5568%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS7ngK0CpgFnSDTZxeU_BYqrmY2Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.117%3A5568%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS7ngK0CpgFnSDTZxeU_BYqrmY2Q&#39;;return true;">http://192.168.1.117:5568/wd/hub" />
</parameters>
    <classes>
      <class name="ParallelTest.SampleParalleltest">
      <methods>
<include name = "OpenUrl" />  <!-- Name of the TESTS -->
</methods>
</class>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

Error which i got while running!

[TestNG] Running:
  C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

[Utils] Attempting to create D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite\Default test.xml
[Utils]   Directory D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite exists: true
FAILED CONFIGURATION: @BeforeTest setUp
org.testng.TestNGException: 
Parameter 'platform' is required by @Configuration on method setUp but has not been marked @Optional or defined
in C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

I will be happy if anyone could help out on this. thanks in advance!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="KL7k-wsoBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="KL7k-wsoBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

80Vikram
I found this https://stackoverflow.com/questions/10651725/how-to-use-testng-parameters-in-beforesuite-to-read-resource-file but it doesn't solve my problem

As I need to pass multiple parameter values for each of the test classes, how to define them at suite level ?

I need the setup for parallel execution with appium + selenium grid + all connected android emulators.

Thanks,
Vikram

On Wednesday, August 2, 2017 at 4:05:26 PM UTC+2, 80Vikram wrote:
Hi Krishnan,

I'm also facing same issue when I've below setup

 
    @BeforeSuite
    @Parameters({ "appName_" })
    public synchronized void setupMethod()

It works well in below case though

    @BeforeTest(alwaysRun = true)
    @Parameters({ "appName_" })
    public synchronized void setupMethod

My requirement is that I need to run multiple test classes in parallel but want to call @BeforeSuite in only 1st test class which does the setup.

Please clarify.

Thanks & Regards,
Vikram

On Monday, July 17, 2017 at 7:34:06 AM UTC+2, Krishnan wrote:

How are you running your test ? Am hoping you are running it from within the IDE by right clicking on the corresponding suite xml file and NOT by right clicking on the corresponding TestNG test class.

If the above still doesn't resolve your issue please make sure you include the following :

1. TestNG version (please use 6.11 which is the latest released version )
2. Sample test code which can be used to recreate the problem ( please trim it to a simple one which doesn't use any selenium etc )
3. How are you running it ? Via IDE (which IDE?) or via a build tool (Gradle/ant/maven) or via command prompt (using Java command)


On Sat, Jul 15, 2017, 01:05 <[hidden email]> wrote:
Hi, did you find any solution for this problem? i have the same(( and cant find the solution


On Thursday, December 1, 2016 at 8:00:34 PM UTC+2, Vinoth Kumar wrote:
I am also facing the same problem, can anyone please help me, find here my code below.

package ParallelTest;

import <a href="http://java.net" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjava.net\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjava.net\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;">java.net.MalformedURLException;
import java.net.URL;

import <a href="http://org.openqa.selenium.By" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class SampleParalleltest {
WebDriver driver;
String baseUrl, NodeUrl;
@BeforeTest
@Parameters ({"platform", "browserName", "remoteurl"})
public void setUp(String platform , String browserName, String remoteurl) throws MalformedURLException{
baseUrl = "<a href="http://youtube.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://youtube.com&#39;;return true;" onclick="this.href=&#39;http://youtube.com&#39;;return true;">http://youtube.com";
DesiredCapabilities capability = null;
if(browserName.equals("chrome")) {
capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
System.out.println("Browser Name is Chrome!" );
} else {
System.out.println("Invalid Browser Name");
}
 
capability.setPlatform(Platform.WIN10);
capability.setVersion("54.0");
capability.setCapability(FirefoxDriver.MARIONETTE, true);
driver = new RemoteWebDriver (new URL (remoteurl), capability);
}
@Test 
public void OpenUrl(){
driver.get(baseUrl);
driver.findElement(By.id("masthead-search-term")).sendKeys("pwrdby");
driver.findElement(By.id("masthead-search-term")).sendKeys(Keys.ENTER);
System.out.println("You opened Google.com on differnt system, and your tEST IS FINE!!");
}

}
*************************
Testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">http://testng.org/testng-1.0.dtd">
<suite name="Suite" thread-count ="1" parallel = "test">
  <test verbose="2" name="WIN10">
  <parameters>
<parameter name ="platform" value = "WIN10"/>
<parameter name ="browserName" value = "chrome" />
<parameter name ="remoteurl" value = "<a href="http://192.168.1.117:5568/wd/hub" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.117%3A5568%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS7ngK0CpgFnSDTZxeU_BYqrmY2Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.117%3A5568%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS7ngK0CpgFnSDTZxeU_BYqrmY2Q&#39;;return true;">http://192.168.1.117:5568/wd/hub" />
</parameters>
    <classes>
      <class name="ParallelTest.SampleParalleltest">
      <methods>
<include name = "OpenUrl" />  <!-- Name of the TESTS -->
</methods>
</class>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

Error which i got while running!

[TestNG] Running:
  C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

[Utils] Attempting to create D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite\Default test.xml
[Utils]   Directory D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite exists: true
FAILED CONFIGURATION: @BeforeTest setUp
org.testng.TestNGException: 
Parameter 'platform' is required by @Configuration on method setUp but has not been marked @Optional or defined
in C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

I will be happy if anyone could help out on this. thanks in advance!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/testng-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

Krishnan Mahadevan

Please share a simple test, which can be executed to reproduce the problem so that it would help folks here understand what is going wrong.

Also include the following information:

 

  1. TestNG version [ The latest released version is 6.11]
  2. How are you running the tests [via IDE or via a build tool]
  3. What does your suite xml file look like

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of 80Vikram <[hidden email]>
Reply-To: <[hidden email]>
Date: Wednesday, August 2, 2017 at 7:54 PM
To: testng-users <[hidden email]>
Subject: Re: [testng-users] Re: org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method beforeclass but has not been marked @Optional or defined

 

I found this https://stackoverflow.com/questions/10651725/how-to-use-testng-parameters-in-beforesuite-to-read-resource-file but it doesn't solve my problem

As I need to pass multiple parameter values for each of the test classes, how to define them at suite level ?

I need the setup for parallel execution with appium + selenium grid + all connected android emulators.

Thanks,
Vikram

On Wednesday, August 2, 2017 at 4:05:26 PM UTC+2, 80Vikram wrote:

Hi Krishnan,

I'm also facing same issue when I've below setup

 
    @BeforeSuite
    @Parameters({ "appName_" })
    public synchronized void setupMethod()

It works well in below case though

    @BeforeTest(alwaysRun = true)
    @Parameters({ "appName_" })
    public synchronized void setupMethod

My requirement is that I need to run multiple test classes in parallel but want to call @BeforeSuite in only 1st test class which does the setup.

Please clarify.

Thanks & Regards,
Vikram

On Monday, July 17, 2017 at 7:34:06 AM UTC+2, Krishnan wrote:

How are you running your test ? Am hoping you are running it from within the IDE by right clicking on the corresponding suite xml file and NOT by right clicking on the corresponding TestNG test class.

If the above still doesn't resolve your issue please make sure you include the following :

1. TestNG version (please use 6.11 which is the latest released version )
2. Sample test code which can be used to recreate the problem ( please trim it to a simple one which doesn't use any selenium etc )
3. How are you running it ? Via IDE (which IDE?) or via a build tool (Gradle/ant/maven) or via command prompt (using Java command)

 

On Sat, Jul 15, 2017, 01:05 <[hidden email]> wrote:

Hi, did you find any solution for this problem? i have the same(( and cant find the solution



On Thursday, December 1, 2016 at 8:00:34 PM UTC+2, Vinoth Kumar wrote:

I am also facing the same problem, can anyone please help me, find here my code below.

 

package ParallelTest;

 

import java.net.MalformedURLException;

import java.net.URL;

 

import org.openqa.selenium.Keys;

import org.openqa.selenium.Platform;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.remote.DesiredCapabilities;

import org.openqa.selenium.remote.RemoteWebDriver;

import org.testng.annotations.BeforeTest;

import org.testng.annotations.Parameters;

import org.testng.annotations.Test;

 

public class SampleParalleltest {

WebDriver driver;

String baseUrl, NodeUrl;

@BeforeTest

@Parameters ({"platform", "browserName", "remoteurl"})

public void setUp(String platform , String browserName, String remoteurl) throws MalformedURLException{

baseUrl = "http://youtube.com";

DesiredCapabilities capability = null;

if(browserName.equals("chrome")) {

capability = DesiredCapabilities.chrome();

capability.setBrowserName("chrome");

System.out.println("Browser Name is Chrome!" );

} else {

System.out.println("Invalid Browser Name");

}

 

capability.setPlatform(Platform.WIN10);

capability.setVersion("54.0");

capability.setCapability(FirefoxDriver.MARIONETTE, true);

driver = new RemoteWebDriver (new URL (remoteurl), capability);

}

@Test 

public void OpenUrl(){

driver.get(baseUrl);

driver.findElement(By.id("masthead-search-term")).sendKeys("pwrdby");

driver.findElement(By.id("masthead-search-term")).sendKeys(Keys.ENTER);

System.out.println("You opened Google.com on differnt system, and your tEST IS FINE!!");

}

 

}

*************************

Testng.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Suite" thread-count ="1" parallel = "test">

  <test verbose="2" name="WIN10">

  <parameters>

<parameter name ="platform" value = "WIN10"/>

<parameter name ="browserName" value = "chrome" />

<parameter name ="remoteurl" value = "http://192.168.1.117:5568/wd/hub" />

</parameters>

    <classes>

      <class name="ParallelTest.SampleParalleltest">

      <methods>

<include name = "OpenUrl" />  <!-- Name of the TESTS -->

</methods>

</class>

    </classes>

  </test> <!-- Test -->

</suite> <!-- Suite -->

 

Error which i got while running!

 

[TestNG] Running:

  C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

 

[Utils] Attempting to create D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite\Default test.xml

[Utils]   Directory D:\Vinoth\Selenium\Updated one\Workspace\ParalelTestwithSeleniumgrid\test-output\Default suite exists: true

FAILED CONFIGURATION: @BeforeTest setUp

org.testng.TestNGException: 

Parameter 'platform' is required by @Configuration on method setUp but has not been marked @Optional or defined

in C:\Users\giri\AppData\Local\Temp\testng-eclipse-2096902633\testng-customsuite.xml

 

I will be happy if anyone could help out on this. thanks in advance!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Loading...