Friday 12 September 2014

An example of Cucumber test (Selenium Ruby) - Lesson1

With this post I would like to guide you, the beginner with Cucumber automation test, a very first project about Cucumber test based on Selenium Ruby

1. I supposed that you have installed Ruby (version 1.9.3 or 2.0.0) on your PC, install Ruby DevKit and some basic gems of ruby, ex: selenium-webdriver, selenium-client, capybara, cucumber.
(refer to my old post for details: http://hvn-automation.blogspot.com/2014/09/install-selenium-ruby-capybara-step-by.html)

2. In order to run a test with cucumber you need 3 basic files:
  • .env.rb
  • *.feature
  • _steps.rb
3.  Create a new project named "Demo", create a directory "features" in this project

      3a. create env.rb
      3b. create youtube.feature
      3c. run the youtube.feature for the first time to let editor generate step definition for youtube.feature

      3d. Customize your step definition in youtube_steps.rb
4. Run your test again, you will see the test run smoothly and all step passed.

5. Download the example here

View my demo on youtube.

Hope this help!