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

From Test Automation Wiki
Jump to: navigation, search
Line 4: Line 4:
 
[[File:winstall-ruby.png|right|225px]]
 
[[File:winstall-ruby.png|right|225px]]
 
<ol>
 
<ol>
     <li>Download and open <a href="http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p598.exe?direct">
+
     <li>Download and open [http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p598.exe?direct rubyinstaller-2.0.0-p598.exe]*
        rubyinstaller-2.0.0-p598.exe</a>*
 
 
     </li>
 
     </li>
 
     <li>Accept the terms</li>
 
     <li>Accept the terms</li>
Line 19: Line 18:
 
<h2>Installing DevKit</h2>
 
<h2>Installing DevKit</h2>
 
<ol>
 
<ol>
     <li>Download and open <a
+
     <li>Download and open [http://cdn.rubyinstaller.org\archives\devkits\DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe]
            href="http://cdn.rubyinstaller.org\archives\devkits\DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe">DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe</a>
 
 
     </li>
 
     </li>
 
     <li>Extract to C:\Ruby\devkit\</li>
 
     <li>Extract to C:\Ruby\devkit\</li>
Line 46: Line 44:
 
     <li><code>gem update --system</code></li>
 
     <li><code>gem update --system</code></li>
 
     <span class="comment">To make sure everything is up to date</span><br/>
 
     <span class="comment">To make sure everything is up to date</span><br/>
     <span class="comment"><i><b>Note:</b> There is a chance that you'll get an SSL error, in that case refer to <a
+
     <span class="comment"><i><b>Note:</b> There is a chance that you'll get an SSL error, in that case refer to [http://stackoverflow.com/questions/19150017/ssl-error-when-installing-rubygems-unable-to-pull-data-from-https-rubygems-o/27298259#27298259 this] answer</i></span>
            href="http://stackoverflow.com/questions/19150017/ssl-error-when-installing-rubygems-unable-to-pull-data-from-https-rubygems-o/27298259#27298259">this</a>
 
        answer</i></span>
 
 
     <li><code>gem install rspec --no-ri --no-rdoc</code></li>
 
     <li><code>gem install rspec --no-ri --no-rdoc</code></li>
 
     <span class="comment">Installing rspec because it's a very common used gem</span>
 
     <span class="comment">Installing rspec because it's a very common used gem</span>

Revision as of 16:36, 13 June 2016

Complete Setup Guide for Ruby, Cucumber and Lapis Lazuli on Windows

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.