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!

Monday 1 September 2014

Install Selenium Ruby Capybara step by step

1. Install Ruby
    + visit rubyinstaller.org/downloads/
    + download Ruby 1.9.3-p545
    + download Ruby Development Kit repectively
(Notes: in order to run Selenium Ruby smoothly on both Win7-32,
 and win7-64b, user should select Ruby stable version 1.9.3)
    +Now we install ruby
    +Set Environment Variables to ruby.exe for reuse later

2. Install Ruby Devkit
    + Extract devkit package to C:\DevKit
    + Open cmd, cd to C:\devkit
    + run: "ruby dk.rb init"
    + Open file config.yml to make sure it contains the
        root directories to C:\Ruby1.9.3
    + run: "ruby dk.rb install"

3. Gem installation
   
    Install some basic gem such as:
    + activesupport
    + selenium-client
    + selenium-webdriver
    + rspec
    + capybara

(Note: we can open many command line to install gem)

4. IE webdriver installation

    + Search and install IE driver from google
    + Locate IE driver in C:\Windows\system32

(Notes: if you want to run automation test on Chrome browser,
 just download Chrome Webdriver with the same step as IE driver.
Selenium support Firefox driver, so you don't need to download
FireFox driver)

5. JetBrain RubyMine installation

Install RubyMine editor to write your script. User can use evaluation version for 30 days.

After user has downloaded and install RubyMine, open it and make some default setting.

DONE!!! You've installed all neccessary softs need for your developing selenium ruby script.


Visit my video on Youtube for more details.