follow me icons

Thursday, October 14, 2010

Cucumber, Steps Definitions and Page Models

There are 3 different things involve in writing the automation test. The first one is about writing a cucumber scenario which is where the tester/BA writes the feature or acceptances test in plain text.

For more information about cucumber please visit the official sites of Cucumber which has heaps of information about cucumber. To learn how to write cucumber scenarios effectively please visit the Cucumber's Wiki page.

The second one is writing the steps definitions. This is where we define the code for our cucumber scenarios.

However, alot of times our steps definitions becomes cluttered with all of the xpath or css selections codes. Furthermore, if the web page changes the design, then we have to change all of our steps definition code to work with the new designs. This is where we need a page model design where we defined a particular web page design in a page model file. Gizmo is a really neat rubygems to help us write the page models. So instead of specifying the css or xpath selectors in the steps definitions, we just need to call the css or xpath selectors from the page models.

To see the implementation of page models, please see the "Setting up Cucumber" page where I use cucumber, steps definitions and page models in the project.

No comments:

Post a Comment