user3333018
user3333018

Reputation: 1

Selenium Grid + JUnit + Jenkins -- How to

I have a configuration and tests written that don't work when I pass them through Selenium grid (but work without).

  1. Selenium Tests / JUnit / Eclipse
  2. One Jenkins job that clones the repository and runs the tests
  3. Selenium Grid plugin installed on Jenkins, and all the nodes (Jenkins slaves on Linux with FF) connected to the hub.

Question 1: The Jenkins job for my test suite starts on a slave. Is this correct? Should I start it on master (I tried and got other issues, but at least I would focus on the real problems if I knew what is the correct way to go).

Question 2. I initialize the driver in @Before test. Is this correct? driver = new RemoteWebDriver(new URL("http://......"), DesiredCapabilities.firefox()); This is where I initialize the firefox driver when not using grid, and it is working.

Question 3. How do I tell Selenium grid to offer me some logs. In all fairness, I have no idea if my tests even attempt to visit the hub.

The last question is regarding the error that I get only when using grid (again, all my tests work fine without). org.openqa.selenium.WebDriverException: Specified firefox binary location does not exist or is not a real file: /usr/bin/firefox

There are quite a few solutions for the last error that I have googled and tried, without any luck. Being a beginner, I now doubt my configuration.

Thanks for your time.

Ann

Upvotes: 0

Views: 1494

Answers (1)

ddavison
ddavison

Reputation: 29032

Answers:

Question 1

It's not incorrect to run it on a slave. That's perfectly acceptable.

Question 2

You can initialize the driver wherever you want. You can put it in a @Before, a constructor, or even the method. It's all dependent on what works best for you.

Question 3

i'm not sure if you can do this with firefox, but with the chromedriver you can pass arguments like this: --verbose --log-path=/tmp/chromedriver.log \$*

Last Question

I will answer this question by first asking you a question. your grid and nodes are different servers than your jenkins server? If so, then this most likely means that you need to make sure that your firefox executables are under /usr/bin/firefox. If they are, then make sure that they are executable! e.g.: sudo chmod u+x /usr/bin/firefox

Also, you have your RemoteWebDriver initialization masked so i can't see, but make sure that you have the url of your grid, with /wd/hub concat'ed at the end. e.g.: http://selenium-grid:4444/wd/hub

Upvotes: 1

Related Questions