Discussion:
[Cucumber] [JVM ]Cross Browser Testing using Cucumber
(too old to reply)
Kunal Mehta
2014-12-28 09:49:16 UTC
Permalink
Hello All,
I want to run Cucumber JVM test on list of browser on single instruction. I
have set up my code structure using this article
<http://www.opencredo.com/2013/07/02/running-cucumber-jvm-tests-in-parallel/>.
(adding Modules & Logging)

My requirement is to build and run selected test\s on configured browser\s
and execute them on CI\local environment.Currently I am using Junit and
MVN. I am using SharedDriver (Dependency Injection via PICO) way of opening
and closing browser.

As logging was becoming another hassle in multi threading environment, I am
flexible if on execution all the test are run on single browser first and
then pick up the next browser in sequence. Any reference to git repo will
really help.

I really appreciate if any body can assist or direct me to sources.

Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kunal Mehta
2015-01-06 10:59:02 UTC
Permalink
Hello wonderful people,

wish you all a very happy new year.

any leads on this post is more than appreciated.

AFAIK, Cucumber isn't intended to be a cross browser testing tool.

I just want to understand how teams already using cucumber JVM are coping
up with cross browser testing. There must be a way of saving time by
running test in parallel.

Thanks
Post by Kunal Mehta
Hello All,
I want to run Cucumber JVM test on list of browser on single instruction.
I have set up my code structure using this article
<http://www.opencredo.com/2013/07/02/running-cucumber-jvm-tests-in-parallel/>.
(adding Modules & Logging)
My requirement is to build and run selected test\s on configured browser\s
and execute them on CI\local environment.Currently I am using Junit and
MVN. I am using SharedDriver (Dependency Injection via PICO) way of opening
and closing browser.
As logging was becoming another hassle in multi threading environment, I
am flexible if on execution all the test are run on single browser first
and then pick up the next browser in sequence. Any reference to git repo
will really help.
I really appreciate if any body can assist or direct me to sources.
Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Richard Lawrence
2015-01-06 14:13:43 UTC
Permalink
Without getting into the specifics of CucumberJVM, since I've only done
this in Ruby myself, the general approach I've used is this...

1. Choose a main browser for testing the overall behavior of my app. I
usually prefer a headless browser for this for speed. Use this most of the
time when I run Cucumber on my dev machine.

2. Tag scenarios that are likely to expose differences between browsers.

3. Allow the browser driver to be chosen via a configuration setting of
some sort, e.g. an environment variable or maybe through Maven.

4. Run the tagged scenarios with other browsers as needed on my dev machine
and regularly on a CI machine.


A few important things to note here:

1. Cucumber doesn't care about browsers. All the browser-related stuff goes
in your own code in step defs, hooks, etc.
2. You'll do a separate run of your Cucumber scenarios for each browser.
3. Not every scenario is worth running in every browser, especially if
you're good about keeping scenarios that test non-UI behaviors from
touching the UI.


Hope that helps,

Richard
Post by Kunal Mehta
Hello wonderful people,
wish you all a very happy new year.
any leads on this post is more than appreciated.
AFAIK, Cucumber isn't intended to be a cross browser testing tool.
I just want to understand how teams already using cucumber JVM are coping
up with cross browser testing. There must be a way of saving time by
running test in parallel.
Thanks
Post by Kunal Mehta
Hello All,
I want to run Cucumber JVM test on list of browser on single instruction.
I have set up my code structure using this article
<http://www.opencredo.com/2013/07/02/running-cucumber-jvm-tests-in-parallel/>.
(adding Modules & Logging)
My requirement is to build and run selected test\s on configured
browser\s and execute them on CI\local environment.Currently I am using
Junit and MVN. I am using SharedDriver (Dependency Injection via PICO) way
of opening and closing browser.
As logging was becoming another hassle in multi threading environment, I
am flexible if on execution all the test are run on single browser first
and then pick up the next browser in sequence. Any reference to git repo
will really help.
I really appreciate if any body can assist or direct me to sources.
Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kunal Mehta
2015-01-07 10:44:21 UTC
Permalink
Thanks Richard, each point is worthy enough.

Currently I am already picking up browser from properties file. properties
file exist in .gitignore too, which saves me from any confusion , whilst
running\pushing test on CI.
Locally I keep toggling between browser. this approach works well for few
test but in that case too I want some mechanism by which I can log each
browser log4j logs in different file.

On the other thoughts, would it be good idea to run test on each browser
overnight on CI build. The test & browser can be managed by the time of
test run.

Thanks again for your valuable suggestion.




public class SharedDriver extends EventFiringWebDriver {
private static final WebDriver REAL_DRIVER;
private static final Thread CLOSE_THREAD = new Thread() {
@Override
public void run() {
REAL_DRIVER.quit();
}
};
static Properties OR = null;
static String browser_name = null;
static {

System.out.println("I am in shareddriver static block ");
System.out.println("setting property ");
setProperty();
System.out.println("fetching browser now ");
browser_name=fetchBrowser();
System.out.println(browser_name);
System.out.println("I am in shareddriver static block- Property Set ");
//System.setProperty("webdriver.chrome.driver",
"C:/KM/dOWNLOADS_new/ChromeDriver/chromedriver.exe");
REAL_DRIVER= getInstance(browser_name);
// REAL_DRIVER = new ChromeDriver();
REAL_DRIVER.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
Runtime.getRuntime().addShutdownHook(CLOSE_THREAD);
}



public static void setProperty(){
// initialize properties
System.out.println("***************Initializing Properties
file*******************");
try{
OR = new Properties();
FileInputStream fs = new
FileInputStream(System.getProperty("user.dir")+"\\src\\test\\resources\\OR.properties");
OR.load(fs);
}catch(Exception e){
System.out.println("Error in initializing Properties file");
}
}


public static String fetchBrowser() {
browser_name=OR.getProperty("browser");
System.out.println("values fetched is"+browser_name);
return browser_name;

}
static WebDriver driver;
public static WebDriver getInstance(String browserName) {



switch (browser_name) {
case "firefox":
System.out.println("in firefox");
driver = new FirefoxDriver();
break;
case "chrome":
System.out.println("in chrome");
System.setProperty("webdriver.chrome.driver",
"C:/KM/dOWNLOADS_new/ChromeDriver/chromedriver.exe");
driver = new ChromeDriver();
break;
case "ie":
System.out.println("in IE");
driver = new FirefoxDriver();
break;
default:
System.out.println("in Deafault");
driver = new FirefoxDriver();
break;
}
// maximize browser's window on start
driver.manage().window().maximize();
return driver;
}
Post by Richard Lawrence
Without getting into the specifics of CucumberJVM, since I've only done
this in Ruby myself, the general approach I've used is this...
1. Choose a main browser for testing the overall behavior of my app. I
usually prefer a headless browser for this for speed. Use this most of the
time when I run Cucumber on my dev machine.
2. Tag scenarios that are likely to expose differences between browsers.
3. Allow the browser driver to be chosen via a configuration setting of
some sort, e.g. an environment variable or maybe through Maven.
4. Run the tagged scenarios with other browsers as needed on my dev
machine and regularly on a CI machine.
1. Cucumber doesn't care about browsers. All the browser-related stuff
goes in your own code in step defs, hooks, etc.
2. You'll do a separate run of your Cucumber scenarios for each browser.
3. Not every scenario is worth running in every browser, especially if
you're good about keeping scenarios that test non-UI behaviors from
touching the UI.
Hope that helps,
Richard
Post by Kunal Mehta
Hello wonderful people,
wish you all a very happy new year.
any leads on this post is more than appreciated.
AFAIK, Cucumber isn't intended to be a cross browser testing tool.
I just want to understand how teams already using cucumber JVM are coping
up with cross browser testing. There must be a way of saving time by
running test in parallel.
Thanks
Post by Kunal Mehta
Hello All,
I want to run Cucumber JVM test on list of browser on single
instruction. I have set up my code structure using this article
<http://www.opencredo.com/2013/07/02/running-cucumber-jvm-tests-in-parallel/>.
(adding Modules & Logging)
My requirement is to build and run selected test\s on configured
browser\s and execute them on CI\local environment.Currently I am using
Junit and MVN. I am using SharedDriver (Dependency Injection via PICO) way
of opening and closing browser.
As logging was becoming another hassle in multi threading environment, I
am flexible if on execution all the test are run on single browser first
and then pick up the next browser in sequence. Any reference to git repo
will really help.
I really appreciate if any body can assist or direct me to sources.
Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
naga triveni Medici
2018-09-26 11:49:47 UTC
Permalink
Hi Kunal,

Hope you are doing good. I want to know if we can implement cross browser
testing using cucumber . it would be really great if you take few minutes
to help me out.

I have a feature file and i want to execute that feature file parallel in
all the 3 browser ie, chrome, firefox.....i am using cucumber with maven.
Can i please know if there is a way to get that done.

thanx in advance
Post by Kunal Mehta
Thanks Richard, each point is worthy enough.
Currently I am already picking up browser from properties file. properties
file exist in .gitignore too, which saves me from any confusion , whilst
running\pushing test on CI.
Locally I keep toggling between browser. this approach works well for few
test but in that case too I want some mechanism by which I can log each
browser log4j logs in different file.
On the other thoughts, would it be good idea to run test on each browser
overnight on CI build. The test & browser can be managed by the time of
test run.
Thanks again for your valuable suggestion.
public class SharedDriver extends EventFiringWebDriver {
private static final WebDriver REAL_DRIVER;
private static final Thread CLOSE_THREAD = new Thread() {
@Override
public void run() {
REAL_DRIVER.quit();
}
};
static Properties OR = null;
static String browser_name = null;
static {
System.out.println("I am in shareddriver static block ");
System.out.println("setting property ");
setProperty();
System.out.println("fetching browser now ");
browser_name=fetchBrowser();
System.out.println(browser_name);
System.out.println("I am in shareddriver static block- Property Set ");
//System.setProperty("webdriver.chrome.driver",
"C:/KM/dOWNLOADS_new/ChromeDriver/chromedriver.exe");
REAL_DRIVER= getInstance(browser_name);
// REAL_DRIVER = new ChromeDriver();
REAL_DRIVER.manage().timeouts().implicitlyWait(5,
TimeUnit.SECONDS);
Runtime.getRuntime().addShutdownHook(CLOSE_THREAD);
}
public static void setProperty(){
// initialize properties
System.out.println("***************Initializing Properties
file*******************");
try{
OR = new Properties();
FileInputStream fs = new
FileInputStream(System.getProperty("user.dir")+"\\src\\test\\resources\\OR.properties");
OR.load(fs);
}catch(Exception e){
System.out.println("Error in initializing Properties file");
}
}
public static String fetchBrowser() {
browser_name=OR.getProperty("browser");
System.out.println("values fetched is"+browser_name);
return browser_name;
}
static WebDriver driver;
public static WebDriver getInstance(String browserName) {
switch (browser_name) {
System.out.println("in firefox");
driver = new FirefoxDriver();
break;
System.out.println("in chrome");
System.setProperty("webdriver.chrome.driver",
"C:/KM/dOWNLOADS_new/ChromeDriver/chromedriver.exe");
driver = new ChromeDriver();
break;
System.out.println("in IE");
driver = new FirefoxDriver();
break;
System.out.println("in Deafault");
driver = new FirefoxDriver();
break;
}
// maximize browser's window on start
driver.manage().window().maximize();
return driver;
}
Post by Richard Lawrence
Without getting into the specifics of CucumberJVM, since I've only done
this in Ruby myself, the general approach I've used is this...
1. Choose a main browser for testing the overall behavior of my app. I
usually prefer a headless browser for this for speed. Use this most of the
time when I run Cucumber on my dev machine.
2. Tag scenarios that are likely to expose differences between browsers.
3. Allow the browser driver to be chosen via a configuration setting of
some sort, e.g. an environment variable or maybe through Maven.
4. Run the tagged scenarios with other browsers as needed on my dev
machine and regularly on a CI machine.
1. Cucumber doesn't care about browsers. All the browser-related stuff
goes in your own code in step defs, hooks, etc.
2. You'll do a separate run of your Cucumber scenarios for each browser.
3. Not every scenario is worth running in every browser, especially if
you're good about keeping scenarios that test non-UI behaviors from
touching the UI.
Hope that helps,
Richard
Post by Kunal Mehta
Hello wonderful people,
wish you all a very happy new year.
any leads on this post is more than appreciated.
AFAIK, Cucumber isn't intended to be a cross browser testing tool.
I just want to understand how teams already using cucumber JVM are
coping up with cross browser testing. There must be a way of saving time by
running test in parallel.
Thanks
Post by Kunal Mehta
Hello All,
I want to run Cucumber JVM test on list of browser on single
instruction. I have set up my code structure using this article
<http://www.opencredo.com/2013/07/02/running-cucumber-jvm-tests-in-parallel/>.
(adding Modules & Logging)
My requirement is to build and run selected test\s on configured
browser\s and execute them on CI\local environment.Currently I am using
Junit and MVN. I am using SharedDriver (Dependency Injection via PICO) way
of opening and closing browser.
As logging was becoming another hassle in multi threading environment,
I am flexible if on execution all the test are run on single browser first
and then pick up the next browser in sequence. Any reference to git repo
will really help.
I really appreciate if any body can assist or direct me to sources.
Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
naga triveni Medici
2018-09-26 11:50:16 UTC
Permalink
Hi Richard,

Hope you are doing good. I want to know if we can implement cross browser
testing using cucumber . it would be really great if you take few minutes
to help me out.

I have a feature file and i want to execute that feature file parallel in
all the 3 browser ie, chrome, firefox.....i am using cucumber with maven.
Can i please know if there is a way to get that done.

Thank you in advance.
Post by Richard Lawrence
Without getting into the specifics of CucumberJVM, since I've only done
this in Ruby myself, the general approach I've used is this...
1. Choose a main browser for testing the overall behavior of my app. I
usually prefer a headless browser for this for speed. Use this most of the
time when I run Cucumber on my dev machine.
2. Tag scenarios that are likely to expose differences between browsers.
3. Allow the browser driver to be chosen via a configuration setting of
some sort, e.g. an environment variable or maybe through Maven.
4. Run the tagged scenarios with other browsers as needed on my dev
machine and regularly on a CI machine.
1. Cucumber doesn't care about browsers. All the browser-related stuff
goes in your own code in step defs, hooks, etc.
2. You'll do a separate run of your Cucumber scenarios for each browser.
3. Not every scenario is worth running in every browser, especially if
you're good about keeping scenarios that test non-UI behaviors from
touching the UI.
Hope that helps,
Richard
Post by Kunal Mehta
Hello wonderful people,
wish you all a very happy new year.
any leads on this post is more than appreciated.
AFAIK, Cucumber isn't intended to be a cross browser testing tool.
I just want to understand how teams already using cucumber JVM are coping
up with cross browser testing. There must be a way of saving time by
running test in parallel.
Thanks
Post by Kunal Mehta
Hello All,
I want to run Cucumber JVM test on list of browser on single
instruction. I have set up my code structure using this article
<http://www.opencredo.com/2013/07/02/running-cucumber-jvm-tests-in-parallel/>.
(adding Modules & Logging)
My requirement is to build and run selected test\s on configured
browser\s and execute them on CI\local environment.Currently I am using
Junit and MVN. I am using SharedDriver (Dependency Injection via PICO) way
of opening and closing browser.
As logging was becoming another hassle in multi threading environment, I
am flexible if on execution all the test are run on single browser first
and then pick up the next browser in sequence. Any reference to git repo
will really help.
I really appreciate if any body can assist or direct me to sources.
Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nick Mellor
2017-02-08 03:57:16 UTC
Permalink
Hi Kunal,

We used Gradle tasks to switch browsers, the Gradle task setting an environment variable for the browser and environnent, eg

gradle testDevFirefox

Then we had a Bamboo setup that executed separate tasks for each browser, triggered by a change in the test of Dev codebase. Each Bamboo track ran in a separate AWS instance, executing a Gradle task each.

Hope this helps,

Nick
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nick Mellor
2017-02-08 03:57:17 UTC
Permalink
Hi Kunal,

We used Gradle tasks to switch browsers, the Gradle task setting an environment variable for the browser and environnent, eg

gradle testDevFirefox

Then we had a Bamboo setup that executed separate tasks for each browser, triggered by a change in the test of Dev codebase. Each Bamboo track ran in a separate AWS instance, executing a Gradle task each.

Hope this helps,

Nick
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...