Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are using Cucumber in our application, but previously used Selenium. Cucumber is far better than Selenium, but it may seems to be complicated since has to write gherkin, step definitions may be page objects.

We are using Celerity with Jruby. The flow is: 'gherkin' calls 'Step definition' calls 'Page objects'.

On one hand, every QA tester writing Cucumber tests will have to be familiar with Ruby in order to use page objects, but on the other hand we can avoid code duplication and repeatedly broken tests.

What are the pros and cons of using page objects with Cucumber? Should we stop worrying about duplicate code in tests and stick with using step definitions instead of page objects?

share|improve this question
Please improve your question by focusing on a specific problem or concern you are having. Asking folks if they really use a tool or not is not a real question, it is a poll. See – Robert Harvey Sep 20 '11 at 18:04
I made an edit to the post along the lines of what @RobertHarvey suggested, but I'm not very familiar with the terminology. I hope someone with more knowledge in this area can correct my wording if necessary. – Adam Lear Sep 20 '11 at 18:16
You are discussing Cucumber and Selenium is if they are two different tools to solve the same problem; they aren't. This makes the question confusing, especially because you haven't defined "Page Objects" at all. What API is provided these? Can you provide some code? I'm just not sure what you're asking… – davetron5000 Oct 12 '11 at 19:05
As davetron5000 suggests, there is no reason that Selenium (especially selenium RC with the ruby client) cannot be used to define the cucumber steps. I think you should take a closer look at selenium rc, and cucumber step definitions. – Danny Staple Nov 4 '11 at 23:36

Actually, cucumber has nothing to do with "pages". The page object itself comes with capybara. In case you intend to use cucumber + capybara for testing web pages you have to use the page object, so there are no cons. Additionally, you always have to worry about duplication in case of test cases, but it is a completely different issue.

The structure in nutshell: cucumber scenario -> step definition(s) -> capybara pages. In the background capybara will use the appropriate selenium drivers.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.