Pricing Login
Interactive demos

Click through interactive platform demos now.

Live demo, real expert

Schedule a platform demo with a Sumo Logic expert.

Start free trial
Back to blog results

September 11, 2015 By Greg Sypolt

Automated Testing in a DevOps World

Automated TestingThe objective of automated testing is to simplify as much of the testing effort as possible with a minimum set of scripts. Automated testing tools are capable of executing repeatable tests, reporting outcomes, and comparing results with faster feedback to the team. Automated tests perform precisely the same operation each time they are executed, thereby eliminating human errors – and can be run repeatedly, at any time of day. Below I’ve outline five steps how to get up and running (the right way) with automation.

Step 1: Laying the Foundation

The foundation is the most important element of any building, be it a house or a high-rise. It may seem like a simple part of the overall construction process, but getting the foundation right is incredibly important. Mistakes made in the foundation will only get worse as you go up. It’s known as compounding defects and it means that mistakes grow. Wait! How does this relate to automation? Proper planning will lay a solid automation foundation for project success; without it your project will be shaky and a maintenance nightmare.

To avoid these potential pitfalls and keep on task, you need a good road map – start by:

  • Planning your automation objective;
  • Design the architecture;
  • Training the team;
  • Begin developing test scripts;
  • Releasing to the wild.

Throughout the onboarding process, it is important educate everyone. One of the common misconceptions of automation is that automation is a magic bullet – the initial setup and step creation will take time and effort. Automation requires effort to maintain. This needs to be factored into any planning and estimation. The principles of good programming are closely related to principles of good design and engineering. By enforcing standards, you can help developers become more efficient and to produce code which is easier to maintain with fewer defects. It’s a great opportunity to start shaping your new testing portfolio by educating everyone – they need to understand what type of testing belongs at unit, integration, and api layers when having those conversations during the sprint planning phase.

Step 2: Selecting a Technology

You’ve found the perfect plan and know where you want to build. The excitement is building. It’s time to start thinking about the details that can make all the difference. Choosing the right products and materials for your new home can be overwhelming. The same applies when choosing a testing framework for your automation. It is a critical part of the process. Since there are so many different testing frameworks available, it’s important to create a list of requirements to review when evaluating a framework. To help you, here are some questions to ask as you round out your requirements:

  • Are you looking for Behavior Driven Development (BDD) framework for unit and front-end UI testing?
  • Do you need to support browsers, mobile web, or mobile native apps?
  • Are you looking to run your selenium test locally or in the cloud?
  • Do you need cross-browser testing?
  • Do you need keyword driven framework for non-technical resources?
  • Does your team have sufficient programming knowledge for automation development?
  • Are you practicing continuous integration and need a tool that integrates seamlessly?

Step 3: Configuration

Find the right pro who specializes in exactly the type of work you need done. You would never hire a plumber to do electrical work. Right?

This stage is critical and can be frustrating with a lack of experience. It would be ideal to find an automation expert to design your automation architecture, teach the team the fundamental skills how to write quality tests, and continuous mentoring. If hiring an expert is not an option, I strongly suggest finding an on-site training course for everyone planning to write tests.

Step 4: The Basics

Every construction trade require basic knowledge of the service. I couldn’t even imagine building interior framing wall without any basic knowledge. The framing basics of your wall include the sill plate on the bottom, the wall studs (which are the vertical beams), and the top sill plate (which is the beam running across the top). It sounds simple in theory, but to get a wall plumb and square takes basic knowledge and a lot of practice.

The same applies when writing automation scripts. One of the basic principles of automation is to understand how to find locators and NEVER use xPaths. It is critical that engineering teams are designing software with automation in mind. What does that mean exactly? Educate engineers how to define unique and predictable locators needed for automation. The most efficient way and preferred way to locate an element on a web page is by HTML element ID or CSS Selector. The ID and CSS are the safest and fastest locator option and should ALWAYS be the first choice. Let’s start with, only use xPath if that is the ONLY possible way, personally this is great opportunity to push back to engineering to provide predictable locators for your scripts. Here are example how to write an automation script from predictable HTML elements;

HTML code with well defined locators:

<div class="grid location-search-result js-store js-search-result" data-showclosed="true" 
data-substituted="false" data-delivery="false" data-carryout="true" data-online="true" 
data-orderable="Carryout Delivery" data-open="true" data-type="Carryout" 
data-storeid="4348" data-services="Carryout"> 
<a class="js-orderCarryoutNow js-carryoutAvailable btn btn--block" data-type="Carryout" data-ordertiming="current" href="#/section/Food/category/AllEntrees/"&gt;Order Carryout</a>

Write a script using Capybara testing framework:

expect(page).to have_css('.js-orderCarryoutNow')

Step 5: Let’s Code

FINALLY, the construction begins! Here are my tips for getting started with writing great automation scripts.

Repeatable. Automated scripts must be repeatable. You must be able to measure an expected outcome.
Design Test for Scalability. The whole point of automation is to provide rapid feedback. Creating and executing large-scale automated tests need a thoughtful approach to elements in the process and a close eye on test design. Keep tests lean and independent.
Easy to Understand. Scripts should be readable. Ideally, your scripts also serve as a useful form of design and requirement documentation.
Speed. Your automated tests should run quickly. The end goal is to make the overall development process faster by establishing rapid feedback cycles to detect problems.

Sample test using Capybara:

describe "on the google homepage -", :google, :type => :feature do

 before :each do
 visit ''

 it "the search input field is present" do
 expect(page).to have_css('input#lst-ib.gsfi')


Your road to automation can be difficult, but it’s worth it. To it well you need the right attitude. Sometimes you will hit roadblocks. If something didn’t work, you really learn to problem solve here. The training phase is so important and incredible opportunity to master your new craft – pay attention, have the right attitude, adapt, be engaged, and never stop learning…

About the Author

Greg Sypolt (@gregsypolt) is a senior engineer at Gannett and co-founder of Quality Element. The last 5 years focused on creation and deployment of automated test strategies, frameworks, tools, and platforms.

Complete visibility for DevSecOps

Reduce downtime and move from reactive to proactive monitoring.

Sumo Logic cloud-native SaaS analytics

Build, run, and secure modern applications and cloud infrastructures.

Start free trial

Greg Sypolt

More posts by Greg Sypolt.

People who read this also enjoyed