Engineers in charge of Test Automation face different challenges in the projects. In this white paper, we focus on understanding TA challenges common in the Agile environment.
Engineers in charge of Test Automation (further: “TA”) face different challenges in the projects, depending on team size, geographic locations of teams, complexity of project, technologies, methodology/lifecycle used etc. In this white paper, we focus on understanding and dealing with TA challenges common in Agile environment.
The fundamental difference between Agile and traditional Waterfall is:
- Agile encourages early discovery of issues. This is often cited as “Fail Fast” and it takes some time for the teams to get used to this symbiotic relationship between Agile software development and failure.
- Waterfall considers testing as a mass effort at near-end of the project. However, what happens at the end of testing (release pass or fail) is quite uncertain. More than ever before, in today’s business uncertainty is a bad thing for investors, so that is, in simplest terms, one of the reasons companies opt for Agile approach.
Even without going into more detailed discussion about differences between the two approaches, one can conclude that testing and TA in Agile is executed in a very different way from the traditional one. Development, on one side, and functional, integration and performance testing on the other: all need to be executed simultaneously. On top of this, there are other activities typical for most Agile flavors, like sprint planning, demos, retrospective etc. Then, there is a continuously changing [business] environment and development process where only essentials are documented. Considering all these factors, it is easy to understand how much test engineers need to learn and understand to be successful in testing, let alone in TA.
Agile encourages and welcomes change and to keep that change under control (i.e. to prevent bugs from leaking to production), team has to invest in TA and, more broadly, in Continuous Integration to shorten the feedback cycles [time from a commit to the test results] and to avoid having repetitive tasks executed by engineers.
All TA efforts, in general, have different cost/benefit ratios. Some things make more sense to be automated than others, because automation is neither trivial nor cheap process:
- First off, it makes sense to automate functionality that is critical for business and that is most used
- It is important to cover integration points between various components and systems because they may change continuously in a project
- Tests with huge input data, where results are usually statistically analyzed, are also good candidates for automation
- Repetitive procedures and error-prone tasks: typical examples in Continuous Integration (CI) include application deployment, loading data and configuring the system
- Areas that have been assigned specific service level agreements (SLAs) cannot be verified without automation, etc.
Now that we have identified some of the constraints inherent to the development process and typical areas where automation provides best cost/benefit, we can discuss specific TA challenges. We are going through the 5 important aspects of successful test automation approach in Agile, namely:
- Allocating time for testing and TA
- Understanding what it means that Test Script is Done in Regression Testing context
- Selecting the tool(s) for TA
- Understanding what is going on with the environments
- Making it easier to test
Allocating time for testing and TA
One of the typical traps of Agile when it comes to testing is that team develops a feature in, say, Sprint 1 and tests it in Sprint 2. Even worse, if fixes are delivered in Sprint 3, this means that team is not delivering a potential shippable increment (PSI) at the end of the sprint but by the end of 3 sprints.
Agile recommends that during sprint planning, team selects features that can be developed and tested (with critical fixes verified) during a single sprint, which means that teams need to allocate enough time for testing and TA. One can observe that many Agile teams really do say quality is a team-wide responsibility, but only few of them realize that quality is delivered only when TA and test artifacts have the same importance as the code.
Therefore, time must be explicitly allocated for testing, automation begins as early as possible (ideally, teams go into Test Driven Development (TDD) mode) and should not lag behind the development. Acceptance criteria and retrospective sessions should give enough attention to TA. Moreover, testers should have enough time allocated for exploratory testing that is performed manually. Without proper resource allocation, tests will lag behind the code development and this creates a huge risk for the business.
Understanding what it means that Test Script is Done in Regression Testing context
TA enables effective regression testing, i.e. repeating [almost] the same suite of tests against successive builds to give feedback to the team about how are they progressing and how stable the code is. There is a balancing effort between results comparability and changing the tests: on one end, test results are comparable only if tests are not changed, but on the other end, tests must change continuously: some new checks are added, some ‘old’ checks are changed because underlying business requirements changed etcs.
In Regression Testing, it is important to understand what it means that test script is Done. In simplest terms, test script is Done when it runs out of testers’ hands: automatically, independently, correctly, without a single click and away from tester’s machine. These scripts are usually part of the regression testing framework that not only executes the tests, but prepares the environment, performs teardown and reports results. Therefore, test scripts are Done in Regression Testing context only when they are out of testers’ hands and when results they produce are used in decision making.
In addition, there are some test scripts quality attributes that require careful attentions:
- Correctness: if a test script reports 90% success rate, is it really the 90% as expected? Test the test scripts by simulating failover scenarios, invalid deployments and configurations etc
- Integrity: ideally, environment after the script has completed should be in a state that allows other scripts to execute and produce valid results, as well as the same test script to execute repeatedly. Designing the script in a 3 stage way: Setup, Test and Teardown, helps understand this issue
- Maintainability: how much effort does it take to adjust test scripts to the changed requirements, interfaces, data structure, accounts, platforms etc
- Versioning: scripts go in parallel with the code and should be versioned together with the code. Many teams simply deliver test scripts with every build
- Portability: can test scripts easily switch between different environments? Environment specific parameters should be decoupled from the scripts
- Performance: the time it takes for script to complete is critical in Continuous Integration. Coverage of the script should not be simply slashed just to have the results arrive quickly: test performance needs to be analyzed and tuned because new scripts come in constantly and only few of the old ones get retired
Next time when evaluating whether a test script is really Done, consider all of the attributes mentioned above.
Selecting the tool(s) for TA
Selecting the tools for TA in an Agile environment involves evaluating different criteria than in case of traditional software development processes. Given the infrastructure diversity in today’s business, it is easy to understand why testing tools need to be able to work on various platforms (Linux, Windows etc). With non-GUI testing, like web services, databases, it is desirable to have the tools with flexible command line support because command line is a perfect gateway to automation, especially on Linux/Unix environments.
Controlling costs is always an important issue for a software company. If a free tool can satisfy testing needs, this means that anyone in the Agile team can use the same tool and share the same script without additional costs. Contrary to that, when a company needs to invest considerable money in tools licensing, it will probably end up in a situation where not everyone in the team has access to the testing tool, and in Agile that is a considerable limitation.
However, as project matures, engineers realize limitations of free testing tools and they see opportunities to enhance the TA and Regression Testing process if they could change just a tiny thing in the tool. Now we arrive at open source tools. Like no other industry, software industry has access to incredible free open source tools that are relatively easy to customize (just check the license agreement). What if the project is using the new technologies that are still in beta? There are no test tools for them, but adapting existing open source tools may be the right answer.
Finally, there is no use in testing unless there is an easy way to access the test results. Teams will need to use testing tools and the CI framework to enable reporting and alerting, so that is another important feature to consider when choosing the TA tool.
Understanding what is going on with the environments
Except in the small-size projects, software engineers working in the development and testing will often use and share multiple environments. These environments range from simple Virtual Machines (multiple VMs can coexist on the same hardware, potentially saving some money) to complex cloud environments that depend on multiple external services and are geographically distributed in several data centers. Either way, knowing exactly what is happening with the environment is crucial time saver for Agile teams.
While testing, first things engineers see are the symptoms – only then, root causes are searched for. Several reasons, or their combinations, may result in software behavior that is different than what was expected: data issues, environment configuration, services availability, the way exceptions are handled, software bugs, hardware failures, network problems, insufficient disk space etc. Note that actual software bugs are only one part of the story and teams that cannot distinguish between a bug and other problems will face the false alarms quite often. After 10 false alarms, team may not react properly on the 11th which could be a critical bug.
Therefore, monitoring all aspects of the environment allows Agile teams to understand Why software is behaving the certain way. No monitoring means a lot of time wasted and a lot of false alarms. So how does monitoring relate to TA? Firstly, environment checks are something that has to be automated (sometimes using the same tools like for actual testing). Secondly, it is important to build the monitoring system in order to let the engineers work on TA instead of wasting too much time trying to understand what is happening with the test environment.
Making it easier to test
Lean teaches us to eliminate anything that does not create a value for the end customer. So how about the test scripts and complex Continuous Integration framework and infrastructure? Are they considered as wastein Lean? They should not, because they directly contribute to delivering what customer needs: quality software [updates] on time.
There are more and more projects where development invests time into building specific configurations, interfaces, hooks etc to unlock the real power of TA. Here are several examples to consider:
- Many projects benefit from changing how the logs are tracked, i.e. enabling live log display within the application, or returning the log within the web service response. Also, the format of the logs is important for tools that enable [distributed] logs indexing and analysis
- GUI projects benefit from creating testing hooks for specific application parts or controls. This enables TA that is more resilient to design changes on the UI level
- Sometimes, teams decide to alter their API and develop new methods specifically for testing. For example, customer does not ask for delete functionality, but it is very important for the testing, so team exposes this additional feature specifically for testing purposes
- Analytics is another example how aggregate data can aid testing: logging detailed processing workflow, performance of every step, inputs and outputs… makes it easier for discovering bugs and repeating problematic scenarios
Whatever strategy is chosen for making the testing easier, team has to be aware that altering APIs and providing details about the processing may also be a security breach. Therefore, these hooks and additions need to be either hidden and protected or simply stripped from the builds that are promoted to production environments.
Conclusion
As more and more teams dive into Agile, they realize how much Test Automation (TA) approach affects success of the project. Successful TA approach together with Continuous Integration unlocks the potential of the team to work with huge volume of changes in a controlled manner. Traditional ‘developer to tester’ ratios like 3:1 or 2:1 simply do not work in Agile environment. Every team member can and should contribute to building a successful TA approach, but this can happen only after team realizes that test scripts are as valuable to the development process as the code itself.
Different aspects discussed in this whitepaper enable the team to evaluate and benchmark its processes and practices. They all have one thing in common and that is following the Agile principle Fail Fast and working with the failures, not running away from them.
Really a thoughtful and directed write up on using automation in Agile. Sometimes we jump on to automating a lot of acceptance tests w/o following a structured approach. But this article is indeed describing the right way to do it. Thanks for sharing.