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

From Test Automation Wiki
Jump to: navigation, search
Line 7: Line 7:
 
<h2>Installing Ruby</h2>
 
<h2>Installing Ruby</h2>
 
[[File:winstall-ruby.png|right|225px]]
 
[[File:winstall-ruby.png|right|225px]]
<ol>
+
# Download and open [http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p648.exe]
    <li>Download and open [http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p598.exe?direct rubyinstaller-2.0.0-p598.exe]*
+
# Accept the terms
    </li>
+
# Install to C:\Ruby
    <li>Accept the terms</li>
+
# Check all 3 checkboxes
    <li>Install to C:\Ruby **</li>
 
    <li>Check all 3 checkboxes</li>
 
</ol>
 
 
<blockquote>
 
<blockquote>
 
* Ruby version 2 is used here because this is currently the most stable version in combination with Windows and the plugins we're using.
 
* Ruby version 2 is used here because this is currently the most stable version in combination with Windows and the plugins we're using.
 
* We're installing Ruby 32 bit because 64 bit can cause issues.
 
* 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.
+
* You can install to a different folder, but in the rest of this tutorial we will refer to this folder.
 
</blockquote>
 
</blockquote>
  
 
<h2>Installing DevKit</h2>
 
<h2>Installing DevKit</h2>
<ol>
+
# Download and open [http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe]
    <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]
+
# Extract to C:\Ruby\devkit\
    </li>
+
#* [[File:winstall-devkit.png|225px]]
    <li>Extract to C:\Ruby\devkit\</li>
+
# Open command prompt
[[File:winstall-devkit.png|225px]]
+
## Go to Run (Windows Key + R)
    <li>Open command promt</li>
+
## Write 'cmd'
    <ol type="a">
+
## Press enter
        <li>Go to Run (Windows Key + R)</li>
+
#* [[File:winstall-runcmd.png|225px]]
        <li>Write 'cmd'</li>
+
# Go to C:\Ruby\devkit
        <li>Press enter</li>
+
# Write <code>ruby dk.rb init</code> *
    </ol>
+
# Write <code>ruby dk.rb install</code> **
[[File:winstall-runcmd.png|225px]]
+
#* [[File:winstall-devkit-console.png|225px]]
    <li>Go to C:\Ruby\devkit</li>
+
 
    <li>Write <code>ruby dk.rb init</code> *</li>
 
    <li>Write <code>ruby dk.rb install</code> **</li>
 
[[File:winstall-devkit-console.png|225px]]
 
</ol>
 
 
<blockquote>
 
<blockquote>
 
* You should see "found rubyinstaller"
 
* You should see "found rubyinstaller"

Revision as of 09:09, 30 June 2016


Installing Ruby

Winstall-ruby.png
  1. Download and open [1]
  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 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 tutorial 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\
    • Winstall-devkit.png
  3. Open command prompt
    1. Go to Run (Windows Key + R)
    2. Write 'cmd'
    3. Press enter
    • Winstall-runcmd.png
  4. Go to C:\Ruby\devkit
  5. Write ruby dk.rb init *
  6. Write ruby dk.rb install **
    • 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. This is 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 lapis_lazuli --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 lapis_lazuli": "Hey Ruby, I want you to do something with a gem, which is installing and the name is lazpis_lazuli". After which Ruby is going to look online in their software system looking for a gem called lapis_lazuli.