Automation Testing Tutorial
Automation Testing Tutorial
Let’s explore the first tutorial from “The Ultimate Guide to Automation Testing”
series!!
What You Will Learn: [hide]
What is Automation Testing?
Scenarios which require Automation
Simple Example of Test Automation
What are Assertions?
Automation Testing – A Cost-effective Method for Regression Testing
Conclusion
Recommended Reading
You try to enter random data in this form which took around 20 minutes. Then you press
submit. Wolla!! An error message is shown which looks like an unhandled exception. You
become very happy. You proudly note down the steps and report the bug in your bug
management system. Great effort, you feel really confident and energetic. You continue the
testing until the day ends and find some more bugs. “Amazing first day”, you thought.
Now comes the next day, the developer has fixed the issue and releases a new version of
the build. You test the same form with the same steps and you found that the bug is fixed.
You mark it fixed. Great effort. You have contributed to the quality of the product by
identifying that bug and as this bug is fixed, the quality is improved.
Now comes the third day, a developer has again released a newer version. Now you again
have to test that form to make sure that no regression issue is found. Same 20 minutes.
Now you feel a little bored.
Now imagine 1 month from now on, newer versions are constantly releasing and on every
release, you have to test this lengthy form plus 100 of other forms like this, just to make
sure that no regression is there.
Whenever such situation arises, you should automate your test case. Test automation is
your friend. It will help you to focus on new functionality while taking care about the
regressions. With automation, you can fill that form in less than 3 minutes.
The script will fill all the fields and tell you the result along with screenshots. In case of
failure, it can pinpoint the location where the test case failed, thus helping you to reproduce
it with ease.
For Example,
1. Comparing two images pixel by pixel.
2. Comparing two spreadsheets containing thousands of rows and columns.
3. Testing an application under the load of 100,000 users.
4. Performance Benchmarks.
5. Testing the application on different browsers and on different operating systems in
parallel.
These situations require and should be, tested by tools.
Simple Example of Test Automation
When you are testing a software (on the web or desktop), you normally use a mouse and
keyboard to perform your steps. Automation tool mimics those same steps by using a
scripting or a programming language.
For Example, if you are testing a calculator and the test case is that you have to add two
numbers and see the result. The script will perform the same steps by making use of your
mouse and keyboard.
The example is shown below.
[TestMethod]
Mouse.Click(button2);
Mouse.Click(buttonAdd);
Mouse.Click(button3);
Mouse.Click(buttonEqual);
app.Close();
The above script is just a duplication of your manual steps. The script is easy to create and
easy to understand as well.
Same goes for automation testing as well. The only difference here is, when we do that
comparison in test automation, then it is called something else in every tool.
Some tools call it as “Assertion”, some call it as “checkpoint” and some call it as “validation”.
But basically, this is just a comparison. If this comparison fails, for E.g. a screen is showing
15 instead of 5 then this assertion/checkpoint/validation fails and your test case is marked
as failed.
When a test case is failing due to an assertion then that means you have detected a bug
through test automation. You must report it to your bug management system just like you
normally do in manual testing.
In the above script, we have performed an assertion in the second last line. 5 is the
expected outcome, txtResult. DisplayText is the actual outcome and if they are not equal,
we will be shown a message that “Calculator is not showing 5”.
Automation Testing – A Cost-effective Method for Regression
Testing
Automation costs are really higher initially. It includes the cost of the tool, then the cost of
the automation testing resource and his/her training.
But when the scripts are ready, they can be executed hundreds of times repeatedly with the
same accuracy and rather quickly. This will save many hours of manual testing. So the cost
gradually decreases, and ultimately it becomes a cost-effective method for Regression
testing.
Conclusion
This excellent tutorial can be summarized in just 7 points.
Automation Testing:
– Is the testing which is done programmatically.
– Uses the tool to control the execution of tests.
– Compares expected outcomes with the actual outcomes (Assertions).
– Can automate some repetitive but necessary tasks (E.g. Your regression test cases).
– Can automate some tasks which are difficult to do manually (E.g. Load testing scenarios).
– Scripts can run quickly and repeatedly.
– Is cost effective in the long run.
Here, Automation is explained in simple terms, but that doesn’t mean that it is always
simple to do. There are challenges, risks and many other obstacles involved in it. There are
numerous ways by which test automation can go wrong, but if all goes well, then the
benefits of test automation are really huge.