Difference between revisions of "Installing ruby with cucumber on a linux machine (Ubuntu)"

From Test Automation Wiki
Jump to: navigation, search
Line 1: Line 1:
<div style="display: block; float:right; background-color: #FDFDFD; border: 1px #AFAFAF solid; padding: 10px;">
+
<div style-->"display: block; float:right; background-color: #FDFDFD; border: 1px #AFAFAF solid; padding: 10px;">
<categorytree mode=all depth=1>Web_Test_Automation_Tutorial</categorytree>
+
<categorytree mode-->all depth-->1>Web_Test_Automation_Tutorial</categorytree>
 
</div>
 
</div>
  
  
 +
 +
<h2>Installing Ruby 2.3.1</h2>
 +
 +
# Install RVM on https://github.com/rvm/rvm#upgrading
 +
# Upgrade RVM
 +
#* <strong>rvm get stable</strong>
 +
# Install latest ruby
 +
#* <strong>rvm install ruby-2.3.1</strong>
 +
 +
 +
<h2>Installing the necessary plugins</h2>
 +
<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>
 +
 +
Copy the code written below and paste it in the Terminal (right click, paste)
 +
<source>
 +
gem update --system
 +
gem install ffi
 +
gem install rspec
 +
gem install selenium-webdriver
 +
gem install watir-webdriver
 +
gem install lapis_lazuli
 +
gem install cucumber
 +
</source>
 +
<blockquote>
 +
'''
 +
<p>Useful Terminal commands : </p>
 +
<ul>
 +
<li>gem help commands &nbsp;&nbsp;&nbsp;--> displays a list of all gem’s commands</li>
 +
<li>gem list &nbsp;&nbsp;&nbsp;--> displays list of all locally installed gems</li>
 +
<li>ruby -v &nbsp;&nbsp;&nbsp;--> displays installed ruby version</li>
 +
<li>rvm info &nbsp;&nbsp;&nbsp;--> displays the paths where ruby and rvm are installed among other info</li>
 +
</ul>
 +
'''
 +
</blockquote>
 +
 +
<h2>Projects Folder</h2>
 +
 +
# Create a folder named ‘ruby’ in home with the linux GUI:
 +
#*home/user/ruby
 +
#*# ~/ruby/
 +
# Projects folder path should look like:
 +
#*sCuser@Asus-X202EP:~/ruby/projects/projectName$
 +
 +
<h2>Cucumber - Firefox marionette Geckodriver</h2>
 +
<p>To run cucumber you will need to do the following (when using a selenium version below 3v):</p>
 +
# Download the firefox marionette webdriver
 +
#*https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
 +
# Download the geckodriver
 +
# Extract and unzip and move the geckodriver file to /usr/local/bin/ directory
 +
#*/usr/local/bin/ → /home/sCuser/bin/
 +
# Run ruby program with selenium Firefox webdriver.
 +
<em>With Selenium 3.0 and later, you shouldn't need to do anything to use Marionette, as it's enabled by default.</em>
 +
 +
 +
 +
{| class-->"wikitable collapsible collapsed"
 +
! colspan-->"2"| More information about the installations above
 +
|-
 +
| <code>gem update --system</code>
 +
| Will update all default gems installed with Ruby (can be outdated, even though you've just installed Ruby)
 +
|-
 +
| <code>gem install rspec</code>
 +
| Commonly used gem
 +
|-
 +
| <code>gem install selenium-webdriver</code>
 +
| Gem that allows communication with liowsers
 +
|-
 +
| <code>gem install watir-webdriver</code>
 +
| Layer on top of Selenium that simplifies liowser interaction
 +
|-
 +
| <code>gem install lapis_lazuli</code>
 +
| Test automation gem that will enforce best practices, forcing the TA engineer to produce better code.
 +
|-
 +
| <code>gem install cucumber</code>
 +
| 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>
  
 
[[Category:Installing ruby with cucumber]]
 
[[Category:Installing ruby with cucumber]]

Revision as of 14:32, 12 December 2016

"display: block; float:right; background-color: #FDFDFD; border: 1px #AFAFAF solid; padding: 10px;">


Installing Ruby 2.3.1

  1. Install RVM on https://github.com/rvm/rvm#upgrading
  2. Upgrade RVM
    • rvm get stable
  3. Install latest ruby
    • rvm install ruby-2.3.1


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)

Copy the code written below and paste it in the Terminal (right click, paste)

gem update --system
gem install ffi
gem install rspec
gem install selenium-webdriver
gem install watir-webdriver
gem install lapis_lazuli
gem install cucumber

Useful Terminal commands :

  • gem help commands    --> displays a list of all gem’s commands
  • gem list    --> displays list of all locally installed gems
  • ruby -v    --> displays installed ruby version
  • rvm info    --> displays the paths where ruby and rvm are installed among other info

Projects Folder

  1. Create a folder named ‘ruby’ in home with the linux GUI:
    • home/user/ruby
      1. ~/ruby/
  2. Projects folder path should look like:
    • sCuser@Asus-X202EP:~/ruby/projects/projectName$

Cucumber - Firefox marionette Geckodriver

To run cucumber you will need to do the following (when using a selenium version below 3v):

  1. Download the firefox marionette webdriver
  2. Download the geckodriver
  3. Extract and unzip and move the geckodriver file to /usr/local/bin/ directory
    • /usr/local/bin/ → /home/sCuser/bin/
  4. Run ruby program with selenium Firefox webdriver.

With Selenium 3.0 and later, you shouldn't need to do anything to use Marionette, as it's enabled by default.


More information about the installations above
gem update --system Will update all default gems installed with Ruby (can be outdated, even though you've just installed Ruby)
gem install rspec Commonly used gem
gem install selenium-webdriver Gem that allows communication with liowsers
gem install watir-webdriver Layer on top of Selenium that simplifies liowser interaction
gem install lapis_lazuli Test automation gem that will enforce best practices, forcing the TA engineer to produce better code.
gem install cucumber The software that will run the scripts from console.

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