injinia
  • Blog
  • services
  • contact
  • links

Getting started with ruby web automation - Part 1

2/6/2016

0 Comments

 
I've been helping to setup automation for a number of individuals and teams and have decided to publish all of the setups and configs that I've been using. I'll break this down into a couple of parts to focus on each of the steps along the way. If I get ambitious I may even automate the setup...
Picture
First off lets get ruby installed and configured for use
​I've recently switched from ruby 1.9.3 to 2.3 and haven't had too much pain, so lets start with that. Download and run the latest ruby installer from rubyinstaller.org/downloads/, for this example I will be using 2.3.0. Install ruby (as an administrator) in their default folder C:\Ruby230 and don’t forget to check ‘Add Ruby executables to your PATH’.

Open up a console (cmd.exe) and type
ruby -v
and you should get
ruby 2.3.0

Install DevKit

Once again download the correct DevKit from rubyinstaller.org/downloads/, for this example I'm using DevKit-mingw64-32-4.7.2-20130224-1151-sfx. Extract it to C:\DevKit. Add C:\DevKit to your system path.
​














You will need to re-open the console after setting any system path variables. At the command prompt type
cd C:\DevKit
ruby dk.rb init
ruby dk.rb install


Configure and update gems

I usually don’t want ri and rdoc for gems so I disabled it by default. Create a file named .gemrc in your home directory with the following content
gem: --no-ri --no-rdoc
gem update --system


Now to update the gems. At the command prompt type
gem update --system

Install bundler
Bundler is great for taking care of dependencies and taking away the need to install and maintain a bunch of gems. At the command prompt type
gem install bundler
​
Install Ansicon
Ansicon gives you color output in the windows console. This helps a lot with cucumber, and gives some nice options for use when you are writing output to the console. I like to have a number of tools available at all times in the console, so I usually setup a directory called C:\path to put tools like this in. Make sure to add C:\path to your path (see the instructions above.

Grab the latest version of ansicon and extract ansicon.exe, ANSI32.dll, and ANSI64.dll to the C:\path folder.

Set Ansicon as your console
There are two ways to setup ansicon, I prefer to use it directly without changing my regular cmd console, so I simply pin a link to the ansicon.exe in my taskbar. I usually change the icon to something nicer as well.

Configure Ansicon
In the shortcut options (In windows 10 right click on the icon in the taskbar, then right click on ANSI Console)  I set the following in the properties tabs
  • Shortcut
    • Advanced > run as administrator
  • Options
    • Quick Edit Mode
    • Insert Mode
    • Enable Ctrl key shortcuts
    • Extend text selection keys
  • Font
    • Consolas
  • Layout (note, this assumes you have a large monitor)
    • Buffer
      • Width: 220
      • Height: 9999
    • Window
      • Width: 220
      • Height: 40


Side note:
I use windows for GUI automation. The toolset available on windows and the fact that a lot of new QA users use windows makes this an easy choice. Some of the setup/config will work on Mac/Linux, YMMV. Also, this guide assumes that you are an administrator user on your system.
Quick links:
  • ruby installer
  • DevKit installer
  • ansicon
Home directory on windows
To find your home directory, type the following at the command prompt or in a windows explorer address bar %HOMEPATH%
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Author

    Hi, my name is Clancey and I am a quality advocate, automator, and toolsmith.

    I help companies with quality. To do this I end up automating a lot of things, functional testing being one of them.

    Clancey McNeal
    Getting started with ruby automation series
    1. Required Installs
    2. Tools
    3. Project Structure
    4. Page Objects

    Archives

    March 2020
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    February 2014
    December 2013

    Categories

    All
    Cucumber
    Getting Started
    Page Objects
    Rspec
    Ruby
    Setup
    Slack
    Sublime
    Tools
    Web Test Automation

    RSS Feed

Copyright injinia, images copyright Adachi Photography