5

We are using Cucumber in our application after we previously used Selenium. Cucumber is far better than Selenium, but it may seem 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?

Mate Mrše
  • 117
  • 8
TPReddy
  • 51
  • 3
  • 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 http://programmers.stackexchange.com/faq#dontask – 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
  • 3
    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 04 '11 at 23:36

1 Answers1

2

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.

HTH

Zsolt
  • 327
  • 1
  • 6