injinia
  • Welcome
  • Blog
  • contact
  • links
  • Hire Me!

Getting started with ruby web automation - Part 3

23/6/2016

0 Comments

 
Starting a project
There are a number of things I setup by default, folder structure, helper files, snippets, etc. I do this a lot, so have a tool that automates some of this. I've posted it on Bitbucket but it is very much a work in progress.
Folder structure
I like to use Cucumber for most things as it is easy to communicate between testers and business, and management can read it and understand. I also don't like to separate tests that are executed with or without tools.
​Here are the commands to setup the folders

    
Here are the commands to setup the default files

    
Configure your Gemfile
I like to put everything in Gemfiles rather than installing gems directly. This saves me from installing something and forgetting I'm using it when I move to another system.
Here is my Gemfile contents (GemFile)

    
To get these setup, cd to your new_project folder, and run
bundle install

Setup browser drivers
I end up using both phantomjs and chromedriver for my tests. Phantomjs for headless, and chrome for regular use.

PhantomJS
Download phantomjs-x.y.z-windows.zip and extract it to C:\path and check that it is installed by typing
phantomjs --version

​Chromedriver
Download chromedriver_win32.zip and extract it to C:\path.

Putting it all together
To make sure everything is all connected and working correctly a simple feature will allow for testing all of the pieces.

Setup cucumber
​ and your env
cucumber.yml

    
features\suport\env.rb

    
Now you can create your first feature. This feature can be used later to debug your setup. ​
features\debug.feature

    
Picture
Run and watch it fail! (yes, failure is part of the process)
In your new_project folder run
cucumber -p debug
You should see something like this​:











Create the debug setps
These steps give you the basics for doing some debugging.

features\step_definitions\debug_steps.rb

    
Run and watch it pass!
This time when you run, you should wind up at a pry interactive prompt. To exit type exit.

More...
Now the fun begins.
There are a lot of resources out there on how to use these tools now that they are installed and working.

I will post more in the weeks to come on how I use these tools to automate a few different types of sites.
Quick links:
  • capy_farmer
  • cucumber
  • webdriver
  • capybara
  • data_magic
  • page-object
  • site_prism
  • rspec
  • sinatra
  • insomnia
  • phantomjs
  • chrome-driver
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, agile coach, scrum master, automator, and toolsmith.

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

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

    Archives

    June 2023
    May 2023
    April 2023
    June 2021
    March 2020
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    February 2014
    December 2013

    Categories

    All
    AI
    API
    Cucumber
    Espanso
    Getting Started
    Insomnia
    Mouse Without Borders
    Page Objects
    Python
    Rspec
    Ruby
    Setup
    Slack
    Sublime
    Tools
    Web Test Automation

    RSS Feed

Copyright injinia, images copyright Adachi Photography