How to get cucumber to run the same steps against Selenium and a headless browser

StackOverflow https://stackoverflow.com/questions/930108

  •  06-09-2019
  •  | 
  •  

Question

I've been doing some work testing web applications with Cucumber and I currently have a number of steps set up to run with Culerity. This works well, but there are times when it would be nice to run the exact same stories in Selenium.

I see two possible approaches that may work:

  1. Writing each step so that it performs the step appropriately depending on the value of some global variable.
  2. Having separate step definition files and somehow selectively including the correct one.

What is the preferred method for accomplishing this?

Was it helpful?

Solution

Third option: See if Culerity implements the Webrat API. Its README file says: "Culerity lets you (...) reuse existing Webrat-Style step definitions". Couldn't find much more than that though. Ideally, you would be able to switch backends with a config option or command-line argument without having to touch the step definitions.

Of course this would only work if you're not testing Javascript, which Culerity supports, but Webrat doesn't.

OTHER TIPS

HI, have you looked at Capybara? It will allow you to use a variety of web drivers, and will allow you to test javascript-related features as well.

You can schedule the tests to run in Jenkins. Local machine Jenkins software is open source. You can get cucumber plugin in Jenkins so that you can achieve reporting part to your project on top of continuous test run

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top