Automated Testing Intro

Testing is the way that we use to verify that an app is working as we expected. You can have two type of tests manual testing and automated testing or a mix of both of them:

Manual testing

Is when a user verify manually that every functionality of the app works correctly as the requirements express. Normally, the QA team has a list of possible test cases (test suite) or functionalities, and an expected behavior that they want to verify for each one of them, for instance:

Test #1 (Test login screen with correct user and password)

Behavior

1.Enter to the login screen.

2. Input correct user and password.

3. Press the login button.

Expected Result

The app lets you enter into the main screen.


This list of test cases (test suite) extends until to cover every possible functionality that the user can perform using the app.

As you might expect when the app grows or is updated the tests should be updated too, increasing their number for each iteration.

Before shipping the app to consumers every test of the list (test suite) should be exercised and pass. When the results are not as expected the app goes back to the Dev Team. This cycle is repeated until all the tests pass, and the app is delivered to your users.

When a user reports a bug this issue is added as a test case to the list of test cases (test suite) to verify that we’re not repeating the same mistake.

Again after the Dev Team finishes working on a feature the testers exercise every test on the list of test cases (test suite) for validating that everything is ok.

As you can see, as the app evolves the list of test cases (test suite) keep growing and growing, making it difficult and error-prone to test manually. As times goes on is infeasible for the QA team to keep the pace of the Dev Team. In every improvement of the app takes longer and longer to the QA team give feedback to Dev team about if their changes are ok or not.

As a result, we use automated testing to help us to obtain timely feedback about the status of our changes and apply fixes in early stages of Dev cycle.

Code bases that have automated testing on them are safer to modify because when we make changes we are going to receive faster feedback.

For this reasons, Michael Feathers on his book Working Effectively with Legacy Code says that Legacy code is code that has no tests.

Automated testing

With automated testing, we do exactly the same as with do with manual testing the only difference is that we take advance of what machines are good for “repetitive routines”, instead of human labor repeating over and over every test cases of the list (test suite) the computers do it for us.

This helps us to reduce cost and possible failure, because bugs are found in early stage and at the same time give trust to developers to modify and extend the code without worrying about introducing new issues to the code base.

Our approach must be, every time that we write or modify a functionality we write some tests that cover (Code coverage)that portion of the code and verify that the app keeps working as expected.

Extra Resources