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 LawrenceWithout 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 MehtaHello 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 MehtaHello 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.