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

From Test Automation Wiki
Jump to: navigation, search
Line 29: Line 29:
  
  
<h2>Installing the necessary plugins</h2>
+
<h2>Installing the plugins</h2>
 
<p>Now the installation of Ruby is complete, we can start installing the necessary plugins. These are so called “Gems”
 
<p>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)</p>
 
     in Ruby. (A ruby is a gem, so the creators decided to call their plugins gems)</p>
  
Copy the code written below and paste it in the CMD (right click, paste)
+
Copy the code written below and paste it in the CMD (right click, paste). While installing do not copy something else.
 
<source>
 
<source>
 
gem update --system
 
gem update --system
 
gem install lapis_lazuli --no-ri --no-rdoc
 
gem install lapis_lazuli --no-ri --no-rdoc
 
</source>
 
</source>
<blockquote>
+
Installing ''lapis_lazuli'' also installs the gems ''cucumber'', ''Selenium-webdriver'' and ''watir-webdriver''.
'''While you're installing, do not copy any other text onto your clipboard or let your computer go to sleep. If you do so, CMD will stop installing after the last line of text.'''
 
</blockquote>
 
  
  
<h2>Installing the necessary drivers</h2>
+
<h2>Installing drivers</h2>
 +
For executing the test framework you need to have the following browsers installed: ''Firefox'' and ''Chrome''
 +
To let the framework communicate with the  browsers we need to download 2 drivers and place them in the ruby directory ''./ruby/bin''
 +
Download the latest version of [https://sites.google.com/a/chromium.org/chromedriver/downloads | chromedriver]
 +
Download the latest version of https://github.com/mozilla/geckodriver/releases | geckodriver]
  
  
<h2>Installing ANSICON which gives colored output in CMD</h2>
+
<h2>Installing ANSICON</h2>
 
<p> When ANSICON is installed the test results in CMD will be colored. This will greatly improve the readability when working with Cucumber
 
<p> When ANSICON is installed the test results in CMD will be colored. This will greatly improve the readability when working with Cucumber
 
* Download and extract the files [https://github.com/adoxa/ansicon/releases/download/v1.66/ansi166.zip | ansi166.zip]
 
* Download and extract the files [https://github.com/adoxa/ansicon/releases/download/v1.66/ansi166.zip | ansi166.zip]
Line 55: Line 57:
 
More information can be found here [http://qastuffs.blogspot.nl/2011/02/how-to-install-ansicon-for-cucumber-to.html | '''source:''']
 
More information can be found here [http://qastuffs.blogspot.nl/2011/02/how-to-install-ansicon-for-cucumber-to.html | '''source:''']
  
 +
<h3>That's it! You're now ready to start setting up your cucumber project. You can read more about this in the next
 +
    article.</h3>
 +
 +
 +
<h2>Extra information about the installations</h2>
 +
<p>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.</p>
 +
 +
<p>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.</p>
 +
 +
<p>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".</p>
 +
 +
<p>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 lapis_lazuli". After which Ruby is going to look online in their software system
 +
    looking for a gem called lapis_lazuli.</p>
  
 
{| class="wikitable collapsible collapsed"
 
{| class="wikitable collapsible collapsed"
! colspan="2"| More information about the installations above
+
! colspan="2"| More information about gems installed
 
|-
 
|-
 
| <code>gem update --system</code>
 
| <code>gem update --system</code>
 
| Will update all default gems installed with Ruby (can be outdated, even though you've just installed Ruby)
 
| Will update all default gems installed with Ruby (can be outdated, even though you've just installed Ruby)
|-
 
| <source>gem install ffi --platform ruby
 
gem uninstall ffi</source>
 
| This gem is problematic with Windows, so it needs to be re-installed with the <code>--platform ruby</code> argurment.
 
|-
 
| <code>gem install rspec --no-ri --no-rdoc</code>
 
| Commonly used gem
 
|-
 
| <code>gem install win32console --no-ri --no-rdoc</code>
 
| Will give coloured output.
 
 
|-
 
|-
 
| <code>gem install selenium-webdriver --no-ri --no-rdoc</code>
 
| <code>gem install selenium-webdriver --no-ri --no-rdoc</code>
Line 84: Line 93:
 
| The software that will run the scripts from console.
 
| The software that will run the scripts from console.
 
|}
 
|}
 
<p>That's it! You're now ready to start setting up your cucumber project. You can read more about this in the next
 
    article.</p>
 
 
<h2>Extra information</h2>
 
<p>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.</p>
 
 
<p>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.</p>
 
 
<p>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".</p>
 
 
<p>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 lapis_lazuli". After which Ruby is going to look online in their software system
 
    looking for a gem called lapis_lazuli.</p>
 
 
  
 
[[Category:Installing ruby with cucumber]]
 
[[Category:Installing ruby with cucumber]]

Revision as of 16:50, 13 March 2017


Installing Ruby

Winstall-ruby.png
  1. Download and the latest version of Ruby for windows 32 bit on http://rubyinstaller.org/downloads/.
    • We're installing Ruby 32 bit version because it's more reliable than the 64 bit version
  2. Accept the terms
  3. Install Ruby in the default directory (for example Ruby version 2.3.3 will be installed in C:\Ruby23)
  4. Check all 3 checkboxes


Installing DevKit

  1. Download and open the latest Devkit for Windows 32 bit on http://rubyinstaller.org/downloads/
  2. In your ruby directory create a new Folder with the name: devkit
  3. Extract the Devkit into the newly created folder
    • Winstall-devkit.png
  4. Open command prompt
    1. Go to Run (Windows Key + R)
    2. Write CMD
    3. Press enter
    • Winstall-runcmd.png
  5. In CMD go to your ruby directory (for example write the following cd C:\Ruby\devkit)
  6. Write ruby dk.rb init
  7. Write ruby dk.rb install
    • Winstall-devkit-console.png


Installing the 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)

Copy the code written below and paste it in the CMD (right click, paste). While installing do not copy something else.

gem update --system
gem install lapis_lazuli --no-ri --no-rdoc

Installing lapis_lazuli also installs the gems cucumber, Selenium-webdriver and watir-webdriver.


Installing drivers

For executing the test framework you need to have the following browsers installed: Firefox and Chrome To let the framework communicate with the browsers we need to download 2 drivers and place them in the ruby directory ./ruby/bin Download the latest version of | chromedriver Download the latest version of https://github.com/mozilla/geckodriver/releases | geckodriver]


Installing ANSICON

When ANSICON is installed the test results in CMD will be colored. This will greatly improve the readability when working with Cucumber

  • Download and extract the files | ansi166.zip
  • Open CMD and navigate to the directory
    • Navigate to x64 (if you have a 64 bit machine) otherwise navigate to x86
    • To go to the directory write something like cd C:\ANSICON\x64
  • Type ansicon.exe -i and ansicon will be installed.

More information can be found here | source:

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 about the installations

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 lapis_lazuli". After which Ruby is going to look online in their software system looking for a gem called lapis_lazuli.