Difference between revisions of "Installing ruby with cucumber on a windows machine"

From Test Automation Wiki
Jump to: navigation, search
Line 67: Line 67:
  
  
[[Category:Web Test Automation Tutorial]]
+
[[Category:Web Test Automation Tutorial|2]]

Revision as of 12:06, 21 June 2016

Installing Ruby

Winstall-ruby.png
  1. Download and open rubyinstaller-2.0.0-p598.exe*
  2. Accept the terms
  3. Install to C:\Ruby **
  4. Check all 3 checkboxes

* Ruby version 2 is used here because this is currently the most stable version in combination with Windows 7 and the plugins we're using.
* We're installing Ruby 32 bit because 64 bit can cause issues.
** You can install to a different folder, but in the rest of this training we will refer to this folder.

Installing DevKit

  1. Download and open DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
  2. Extract to C:\Ruby\devkit\
  3. Winstall-devkit.png

  4. Open command promt
    1. Go to Run (Windows Key + R)
    2. Write 'cmd'
    3. Press enter

    Winstall-runcmd.png

  5. Go to C:\Ruby\devkit
  6. Write ruby dk.rb init *
  7. Write ruby dk.rb install **
  8. Winstall-devkit-console.png

* You should see "found rubyinstaller"
** In the screenshot a warning a given because I already had it installed.

Installing the necessary plugins

Now the installation of Ruby is complete, we can start installing the necessary plugins. These are so called “Gems” in Ruby. (A ruby is a gem, so the creators decided to call their plugins gems)

  1. Open the command prompt and write the following commands:
  2. gem update --system
  3.    To make sure everything is up to date
    Note: There is a chance that you'll get an SSL error, in that case refer to this answer
  4. gem install rspec --no-ri --no-rdoc
  5.    Installing rspec because it's a very common used gem
    
  6. gem install win32console --no-ri --no-rdoc
  7.    Win32console supports colored output when running scripts in command line
    
  8. gem install watir-webdriver --no-ri --no-rdoc
  9. gem install cucumber --no-ri --no-rdoc

That's it! You're now ready to start setting up your cucumber project. You can read more about this in the next article.

Extra information

This section is for you to have a better understanding of what is happening during the installation. And what the commands we're using in console actually mean.

When we installed ruby, we checked a checkbox saying "Add ruby executables to your PATH". What we did here, was making ruby commands globally accessible in the console.

Now because these commands are global, we can go to devkit folder and write "ruby dk.rb install". Where we are actually saying: "Hey Ruby! I want you to look at this file dk.rb I have here and install it".

Same thing happens with "gem install watir-webdriver": "Hey Ruby, I want you to do something with a gem, which is installing and the name is watir-webdriver". After which Ruby is going to look online in their software system looking for a gem called watir-webdriver.