Introduction to App Automation for Better Productivity and Scaling
Introduction to App Automation for Better Productivity and Scaling
Learn to analyze code stability in the development lifecycle, how to incorporate test automation into DevOps, and the limitations of manual regression testing.
Join the DZone community and get the full member experience.Join For Free
Test automation can improve the development process of software in several cases. The
automation of tests are initially associated with an increased effort, but the related benefits will quickly pay off. Automated tests can run fast and frequently, which is very cost effective for software products with a long shelf life, and, therefore, high maintenance costs. When testing in an agile environment, the ability to quickly react to changing software systems and requirements is necessary. New test cases based on updated features can be added simultaneously to automation in parallel to the development of the software itself. The automation process also leads to a shorter development cycle combined with better quality software, and thus the benefits of automated software testing help quickly outrun the initial costs.
Software Testing Life Cycle (STLC)
The STLC is made of several phases of software testing that are followed in a sequential manner to ensure better software quality and delivery. The phases of an STLC process includes Test Strategy, Test Development, Test Execution, Defect Management, and Delivery. Essentially, “Automation” for the application happens in the Test Strategy and Test Development phase. In the Test Strategy phase, the technical and the functional aspects have to be chalked out with respect to automation development. In the Test Development phase, the development of the automation framework or application starts with the proper documentation of the functionalities that need to be automated as a guide, along with the technical approach that needs to be taken in order to create the automation code block.
Limitations to Manually Checking Regressions for an Application
In today’s era of software development, especially following the agile model, deployment of functionalities to an application has become very regular. So, keeping track of all existing functionalities and the new functionalities coming aboard is very tough, unless we have some application do the job for us to check the regression of the application’s deployment over a certain interval of time.
Regression: Concept and Types
Regression is a term that states that the existing modules within the software system should not break when introducing new modules within the application. Regression can mostly be classified into three types:
Functional regression: Running an entire regression across the application to determine if all the functionalities are working fine.
Unit regression: Running specific regressions on unit modules to check if each module making up the entire application is working properly.
Visual regression: Visually checking on the layout of an application on the web or mobile and all the components on the web and mobile.
CI Is Important to the DevOps Process
When it comes to testing in DevOps, Continuous Integration plays an important role in the software release process. The main concern of Continuous Integration is to resolve integration problems. In Extreme Programming, Continuous Integration was intended to be used in combination with automated regression tests written through the practices of automated test-driven development. Initially, this was conceived of as running all regressions and tests in the developer’s local environment and verifying they all passed before committing to the mainline. This helps avoid one developer’s work-in-progress breaking another developer’s work. In the same vein, the practice of Continuous Delivery further extends Continuous Integration by making sure the application checked in on the mainline is always in a state that can be deployed to users and makes the actual deployment process very rapid.
Continuous Integration thus provides an important aspect in today’s era of software development, as it helps to recover integration bugs and detect them as early as possible, keeping track of the application’s stability over a period of time.
Reference: Setting up a CI job using Jenkins.
Test Automation - A Crucial Aspect in the DevOps Process
A matured testing process is a key differentiator of the overall DevOps infrastructure. A test automation platform, whether it be a test data driven framework or a behavioral driven framework, plays a pivotal aspect in the DevOps process, not only to ensure or verify changes in the code structure or that the code gets integrated properly, but also by ensuring that the
stability of the software is not hampered. Continuous testing is a connecting link between the development and operational flow. The operational aspects come into the flow once the continuous testing gives a “Go Green”. The development phase finishes only when the continuous testing has all its tests passed and the development phase has an assurance that the new code merged has no negative effects on the existing codebase.
Automation Practices and Trends
These are a few of the development trends being followed today:
Behavioral Driven Development (BDD)
Test Driven Development (TDD)
Executing automated tests on the cloud
Behavior-Driven Development, or BDD, is a synthesis and refinement of practices from the Test Data-Driven Development (TDD) and Acceptance Test Data-Driven Development (ATDD). It utilizes a format that is known as the Gherkin language, which helps in automating test scenarios in a behavior-specific format where the tests are formatted in simple English based on the behavior of the elements in the application. The expected benefit of using BDD is that it offers more precise guidance on organizing the conversation between the developers and testers and the domain experts. The notations originating in the BDD approach, in particular the given-when-then
canvas, are closer to everyday language, which everybody on the team can understand. Besides, the tools and frameworks targeting a BDD approach generally afford the automatic generation of technical and end user documentation from BDD specifications.
Test Driven Development
Test-driven development (TDD) is an evolutionary approach to development that combines test-first development where you write a test before you write just enough production code to fulfill that test and refactoring. One goal of TDD is specification and not validation. In other words, it’s one way to think through your requirements or design before you write your functional code. Another view is that TDD is a programming technique. As Ron Jeffries likes to say, the goal of TDD is to write clean code that works
Visual Regression is a technique that is utilized to automate the process of capturing UI/UX-based issues over the long-run for multiple devices. This can be achieved by using different tools and techniques. Visual Regression can take a very important part in the delivery process.
A visual regression testing tool performs front-end or UI regression testing by capturing the screenshots of web pages/UIs and comparing them with the original images (either historical baseline screenshots or reference images from the live website). If the new screenshot deviates from the baseline or reference screenshot, the Visual Regression tool sends notifications about the test failures in an HTML report. In the context of web applications, Visual Regression tools perform visual regression tests mainly on CSS changes. Some of the frameworks and libraries that can be used to carry out Visual Regression are Galen, Wraith, Backstop JS,
and PhantomCSS. These are all open source initiatives and can be used directly by installing their respective binaries. There are other licensed tools as well, including the popular Applitool.
Reference: Visual Regression using Galen
Running Automation Tests on the Cloud
BrowserStack is a cloud-based cross-browser testing tool that enables developers to test their websites across various browsers on different operating systems and mobile devices without requiring users to install virtual machines, devices, or emulators.
Reference: Setting up your automation on BrowserStack
There is another well-known cloud platform where you can run your tests, called SauceLabs.
Headless refers to the running of automated tests without allowing users to see any direct browser interaction, so most of the functionalities run from the backend. So, basically, a headless browser is a web browser without a graphical user interface. Google started using headless browsing in 2009 in order to index the content of websites using Ajax.
Headless automation can be achieved using PhantomJS, CasperJS, or by using SlimerJS. The concept of headless interaction was brought up by Ariya Hridayat, who designed a webkit that could run like a browser without having a UI. PhantomJS is available with Selenium and can be easily used with Selenium as well.
All kinds of testing in the STLC can be handled through automation, depending on the project and other aspects such as ETA, sprints, deployments, etc. But the quality control team definitely needs to do an ROI before even starting automation because the client needs to be sure of the fact that the time and effort invested in developing an automation framework will benefit the project life cycle. But with my experience in the IT industry, automation does give an edge to continuous project management and delivery. It is quite scalable because you can use any language to get started with an automation framework because you have APIs relevant for each library and package.
Published at DZone with permission of Soumyajit Basu , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.