Have you ever thought about becoming an automation engineer? You might have some questions. Where do you start on your career journey? What are the daily tasks involved? What exactly is the value of automation testing? As an automation testing engineer, I’d like to share my journey and offer some tips and resources that helped me along the way.
The Journey Begins
My passion for technology began early on. As a child, I was always curious about how things worked around me. After high school, I attended the University of Craiova to study technology in the Automation, Computers and Electronics program. After graduation I joined Cognizant Softvision, where I participated in the QA Automation Pre-Employment Program, an intensive, month-long training course that teaches the basics of automation.
Cognizant Softvision’s Pre-Employment training was very well structured. The sessions began with recapping the basic principles of programming, including Object-Oriented Programming, and covered examples of when and how some of the most popular tools in automation are used, depending on the context. Although the course was comprehensive, it only gave a basic overview of what automation really means.
Ok, So What Exactly Is Automation Testing?
Automation testing is the process of testing products with special testing tools and frameworks to minimize human intervention and maximize quality. In this process, manual tasks are automated to reduce the manual effort. Once the test suite is automated, minimal human intervention is required, and is mostly needed for maintenance and refactoring. Test results are generated automatically by comparing the expected results with the actual ones. The goal is to reduce the number of test cases that would need to be run manually, not to eliminate the manual testing. Automation engineers can run a set of tests daily to make sure that the main functionalities are working as expected, for example the login functionality for a website.
To truly learn automation, you must dedicate yourself to self-study every day. As a starting point for going in depth with automation learning, there are e-learning platforms such as Udemy and Pluralsight. But since there are so many courses available on these platforms, it can be difficult to choose the best one. With so many different tools and libraries that can be used for almost the same thing, the process can become confusing.
Building An Automation Framework: 4 Steps
To save precious practice time and confusion, the following walks you through the steps required for learning and building an automation framework for a web application. I’ll also share some helpful online tools for instruction.
To get started, we need:
1) A programing language
2) A library that helps with Web Elements interaction (I will explain what these are and the ways to find them)
3) A code structure for easy test maintenance — a Design Pattern
4) An easy way to write test cases for both technical and non-technical audiences
In this process, it is important to decide which tools and libraries will serve us best. I chose JAVA as a programming language, Selenium WebDriver and Page Object Model (POM) as a Design Pattern, along with Cucumber for test case writing.
1) The Programming Language
When it comes to automation, many would agree that the most important thing is the programming language. You have to learn how to use it and understand the logic behind it in order to become a successful engineer.
Java is preferred by 43% of customers when it comes to choosing a programming language for developing automated tests. It’s one of the greatest programming languages for automation because it comes with complete test frameworks, packages and information sources.
Recommended Resource: This Java course is a complete guide and is excellent for all stages of learning.
2) The Library
Selenium WebDriver is a library that can be used with different programing languages, like Java, C#, and Python. It is used for testing Web applications from the UI perspective and it helps us interact with the web elements, such as Text Boxes, Buttons, Check Boxes, and so on.
Selenium Locators are used to identify and to interact with these web elements. The correct identification of WebElement is very important in the process of creating automation scripts. There are different ways of locating web elements with Selenium: by Id, by CSS Selector, by Xpath, by Name, by Link Text.
Recommended Resource: Here is a helpful cheat sheet for Selenium locators syntax.
With time and practice you will discover which is the best locator for your testing scenario. The most recommended method is to locate elements by ID, because these WebElements IDs should be unique. Also, this way you can be sure that you are finding the correct element in the web page.
However, there are times when the IDs are unavailable or IDs are dynamic and their value is changed at every page refresh. In this case, you must use other ways of locating the correct element, depending on what info you have available (class, name, LinkText, etc.). You can also use custom Xpath using the available methods. Refer to this article for more information.
The most important thing is to make sure that, no matter what happens to the webpage structure, you will always locate/interact with the desired web element.
3) The Design Pattern
Page Object Model (POM) is a design pattern that has become popular in test automation for enhancing the test maintenance and reducing code duplicates. POM allows us to keep a clean and structured code.
Recommended Resource: Learn more about POM design principles in this video.
4) Test Framework
Cucumber is a test framework that supports Behavioral Driven Development (BDD). BDD is a software development approach where tests are written in a shared language. It has the advantage of improving the communications between tech and non-tech teams. BDD tests are user-focused and are based on the system’s behavior. Some of the benefits of using BDD include:
- Better communication between team members
- Easy to understand for both technical and non-technical audiences
- Simpler maintenance of the test framework structure
In Cucumber, the BDD specifications are written in plain, simple English which is defined by the Gherkin language. In other words, Gherkin is a language that Cucumber understands.
The following is an example of Gherkin code, but keep in mind that for every step, some Java code is attached in the background.
Feature: User Authentication Background:
Given the user is already registered to the website Scenario:
Given the user is on the login page
When the user inputs the correct email address
Then the user should be authenticated
Words of Advice
In my journey, I found the exercise of building the automation solution from scratch to be extremely helpful. I also discovered an online course that teaches exactly that. It walks you through building an automation solution with the technologies mentioned above and writing clean and structured automation tests.
Recommended Resource: This course has two sections: The first section focuses on Cucumber and the second one focuses on Selenium WebDriver. Completing this course will give you a better understanding on how Selenium (a testing tool for web apps) works with Cucumber (a BDD automation framework) and how to set your very own automation solution.
Now it’s time to start practicing! For your first steps I suggest using this web application because it contains the most common web elements and actions.
While no journey comes without some bumps in the road, with work and perseverance you can reach your goals. Practice and study each day and, when you come across something you’re unsure about, don’t be afraid to ask for help.
Are you beginning your journey to becoming an automation engineer? What have you learned along the way? Let us know in the comments!