Page 1 of 1

Building an Automation Testing Framework for WebApps Part 1

#1 NeoTifa   User is offline

  • NeoTifa Codebreaker, the Scourge of Devtester
  • member icon

Reputation: 4555
  • View blog
  • Posts: 19,224
  • Joined: 24-September 08

Posted 18 April 2017 - 01:30 PM

Building an Automation Testing Framework for WebApps in Ruby by NeoTifa


Part 1.) Introduction
Part 2.) Tools
Part 3.) Setup

~~~~~~~~~~~~Part 1~~~~~~~~~~~

Part 1.) Introduction

Hello, I have gotten a lot of requests on automated testing tutorials, so I thought I'd give it a go. Automated testing is a growing requirement for most jobs, and for most software suites. Where this really shines is for repetitive tasks that you do often, like regression testing or smoke testing. It's great because you can just click "play" and work on something else. This multi-part tutorial should hopefully help you create your own Ruby testing framework (the automation suite is in Ruby, no necessarily the suite you're testing) from the ground up in a click-along type tutorial. This guide assumes you're familiar with Ruby, so it doesn't go into the nuances of the Ruby language.

~~~~~~~~~~~~Part 2~~~~~~~~~~~

Part 2.) Tools

So, some of the tools we will be using so far will be:

RubyMine or some other Ruby IDE (my screenshots are from RM)
Various gems that I will reveal in time
Chromedriver (I test in Chrome) or whatever driver for your browser of choice

In case you don't have bundler installed, just run the command
$gem install bunder

in your terminal. While you're at it, you might as well run these too:
$gem install cucumber
$gem install watir-webdriver
$gem install page-object

There will probably be more gems, but that should get you started. One more note, I'm assuming you're running the most current Ruby so all the gems should be the most current also. Versioning is a pain in the booty, which requires a whole load of coordination from all gems.

Chrome requires chromedriver to run, so you need to make sure you have a compatible driver for your version. At the time I write this Chrome is v57, and chromedriver v2.28. You should also have a 32bit version of Chrome as I think chromedrivers are only in 32bit for windows. If you're on another system you can get 64x but in Win it's 32x.
geckodrivers for ff

~~~~~~~~~~~~Part 3~~~~~~~~~~~

Part 3.) Setup

First things first, create a new Ruby project.
Posted Image
Posted Image

Then, you're gonna wanna make a Gemfile in your project's root directory and add cucumber to the gem list.
Posted Image
Posted Image

bundle install

in a console in the project directory. This should create a Gemfile.lock

Next, create a 'features' folder in the project root. This will hold all of your automation stuff.

I think this is going to be all for now. See you next time.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1