Run a feature file in different browsers at the same time - Selenium cucumber maven framework

Viewed 323

I am using Selenium Cucumber Maven framework with Junit. I need to run the same feature file in different browsers at the same time. Also I need to run the file using command line . Could you guys please help me with a solution since Iam a beginner . @BeforeClass of the TestRunner File is below.

@BeforeClass
public static void before() {   
browserName = System.getProperty("browserName");
if(browserName==null)
    {
        browserName= "chrome";
    }

if (browserName.equalsIgnoreCase("Chrome")) 
{
    System.setProperty("webdriver.chrome.driver", "E:\\ChromeDriverNew\\chromedriver.exe");
    driver=new ChromeDriver(); 
} 
else if (browserName.equalsIgnoreCase("Firefox")) 
{
    System.setProperty("webdriver.gecko.driver","E:\\geckoNew\\geckodriver.exe");
     driver = new FirefoxDriver();
} 

else {
    System.out.println("Error Message----> "
            + "browser name not mentioned properly");
    System.exit(0);
}      
   driver.manage().window().maximize();
  driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);   

}

What are the changes needed to be done in TestRunner file ? It would be a great help if you guys helped me since Iam a beginner. Thanks in advance .

0 Answers
Related