Automated testing: speed up your software delivery
Automated testing has transformed modern software development. Arguably, is one of the main enablers for the explosion of apps over the past decade. Before automated testing, all tests had to be done manually. This was slow, error-prone, and expensive. As a result, it often led to QA teams being seen as a blocker to releasing software. That all changed with the creation of automated testing frameworks.
What is automated testing?
Automated testing refers to any approach that makes it possible to run your tests without human intervention. Traditionally, that involved writing custom scripts that interacted with the backend and inserting test classes within the frontend. However, that approach has now been superseded by automated testing frameworks like Selenium.
These frameworks allow a test script to interact with your UI, replicating the actions of a user. For instance, they allow you to find a specific button and click it. Or locate a text entry box and fill it out correctly. They also allow you to verify that the test has completed correctly. This is done by checking whether a new page has loaded, looking for specific elements on the page, etc.
Why is automated testing so useful
Modern applications tend to be complex and require extensive testing. Your test suite can easily grow to thousands of tests. Many of these need to be run each time you update your codebase. Automated testing allows you to significantly reduce the time needed to run your tests. Automated testing brings three clear benefits:
Improved Scale: Automating your tests transforms the scale at which your test team operates. This is because computers can run tests 24 hours a day, 7 days a week. Even your keenest quality engineers can only manage 60 hours a week! The result is, you get to run many more tests with the same resources. This is important since test engineers are a relatively scarce resource.
Testing complex scenarios: Automated testing also allows your test engineers to focus on developing tests for more complex scenarios. This, in turn, enables you to deliver more reliable and complex applications. This has been key to driving the app revolution over the past 15 years.
Speed of delivery: You are under constant pressure to release new features. However, releasing a buggy application can wipe out all those gains in minutes. Automated testing speeds up your regression testing significantly. In turn, this slashes the time between integrating a new feature and releasing it. At the end of the day, the faster you get new features out, the more competitive you will be.
How to do automated testing
The classic approach is to use Selenium, which has been around since 2004. Selenium aims to replicate the actions of a real user interacting with the UI. It also allows you to write tests in many different languages. These tests are then converted into Selenium test scripts that are passed to the Web Driver. This is what actually interacts with your UI on the browser.
Creating a test script is quite a painstaking task. You need to treat each Selenium test script as a mini software development project. Creating a new script is iterative and slow, requiring frequent rounds of testing and debugging. At each step, you need to do several things:
- Find the correct element on the page
- Decide what selector to use
- Determine the correct action to pass to Web Driver
- Establish the best way to verify the outcome
Test recorders make this a little easier. In a test recorder, you interact with your site, going through your test steps. As you do so, the recorder is converting these steps into a Selenium script. This is quicker than creating the script manually, but you still end up needing to do debugging. You are also unable to create complex tests.
Issues to bear in mind
Automated testing comes with some well-known issues that you need to understand.
Hard to create test scripts
Complex test scripts require you to write complex code. As a result, it takes skilled Test Automation Engineers or Developers in Test to get scripts right. Even a simple test script will take hours to write and debug. You need to keep this in mind when you start to automate your testing.
Need for significant maintenance
Legacy automated testing is extremely unstable. Any change you make to your UI can break all your tests. Even a simple CSS change might cause all the selectors on a page to change. This results in the test choosing the wrong elements on your page. If your script fails to find an element at all, then it fails instantly. However, sometimes it will select the wrong element. This causes real pain as these failures don’t show up until many steps later. Then, your engineers have to track back to find the original cause of the failure and fix it by hand.
Hard to create cross-browser tests
Modern web applications need to work on any platform and browser. So, cross-browser testing is essential nowadays. This requires you to modify and debug your test script for every single combination of browser and platform. This means a team of test engineers could easily take weeks to create a handful of tests.
Intelligent automated software testing
Here at Functionize, we have spent years developing an intelligent test agent. This agent uses different forms of artificial intelligence to deliver exceptional results. Our system specifically addressed the shortfalls of Selenium:
- Tests are easier to create, even for non-experts
- Maintenance is reduced by our robust intelligent element selection
- Tests just work cross-browser without needing rewriting
Overall, this delivers the power and flexibility of Selenium testing with none of the pain.