Automation Testing Tutorial (Ultimate Guide to Start Project Test Automation)

A Complete Guide to Automation Testing: 

Do you want to start automation test on your project but are you struggling with the most basic steps as mentioned below:

Today, we have planned to enrich your knowledge with a series of tutorials on “Getting started with Automation Testing”. This series of automation tutorials will answer all the above questions in a step by step manner with simple examples.

Let’s take a look at the series of Tutorials on Starting Automation on Your Project!!

Automation End-to-end Process:

Tutorial #1: Best Guide to Start Automation on Your Project

Tutorial #2: Types of Automated Tests and Some Misconceptions

Tutorial #3: 10 Steps to Introduce Automation on Your Project

Tutorial #4: The A to Z Guide on Selecting the Best Automation Tool

Tutorial #5: Script Development and Automation Frameworks

Tutorial #6: Execution and reporting of Automation

Tutorial #7: Best Practices and Strategies of Test Automation

Automation Tips:

Tutorial #8: 10 Tips you should read before automating your testing work

Tutorial #9: How Does Test Planning Differ for Manual and Automation Projects

Tutorial #10: When To Opt For Automation?

Tutorial #11: Automation Test Challenges

Tutorial #12: Guide to Implement Proof of Concept (POC) in Automation

Tutorial #13: How to Select Correct Test Cases for Automation

Tutorial #14: How to Translate Manual Test Cases into Automation Scripts

Automation Career:

Tutorial #15: Tips to Become a Better Automation Tester

Tutorial #16: Test Automation – Is it a Specialized Career? Can Normal Testers Do Automation Also?

Popular Automation Tools:

Tutorial #17: Selenium Tutorials 31+ Best Free Selenium Training Tutorials

Tutorial #18: QTP Tutorials

Tutorial #19: SoapUI Web Services Testing Tool

Tutorial #20: HP LoadRunner for Performance Testing

Automation Frameworks:

Tutorial #21: Why Do We Need Framework for Automation

Tutorial #22: Most Popular Automation Frameworks

Automation in Agile:

Tutorial #23: How to Implement Efficient Automation in the Agile World

Other Automation Tools:

Tutorial #24: Best Automation Test Tools

Tutorial #25: Sikuli GUI Automation Tool

Tutorial #26: PowerShell: Desktop Application UI Automation With PowerShell

Tutorial #27: Katalon Automation Recorder (Selenium IDE Alternative)

Tutorial #28: Geb Tool: Browser Automation Using Geb Tool

Tutorial #29: AutoIt: How to Handle Windows Pop-up Using AutoIt

Tutorial #30: Cucumber: Automation Using Cucumber Tool and Selenium

Tutorial #31: Protractor Testing Tool for End-to-end Testing of AngularJS Applications

Mobile Automation Testing:

Tutorial #32: Appium Studio Hands-on Tutorial

Tutorial #33: Appium Tutorial for Beginners

Tutorial #34: Selendroid Tutorial: Android Mobile Automation Framework

Tutorial #35: Ranorex Tutorial: A Powerful Desktop, Web, and Mobile Testing Tool

Domain Specific Automation Examples:

Tutorial #36: Automation of JAVA/J2EE Applications

Interview Preparation for Automation Jobs:

Tutorial #37: Automation Testing Interview Questions

Tutorial #38: Selenium Interview Questions

***********************************************************************

Let’s explore the first tutorial from “The Ultimate Guide to Automation Testing” series!!

What You Will Learn:

What is Automation Testing?

If a software can do anything then, why can’t a software test a software?

Does this statement sound logical to you?

If yes, then congratulations, you are now thinking about Test Automation, which is the center point that we are going to discuss in this series of informative tutorials.



Imagine yourself n the first day at your job as an SQA. You are presented with an application to be tested. It’s an ERP application containing 100s of forms and thousands of reports. You begin your exploratory testing by opening a form which contains around 50 different fields.

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.

Now you feel angry. You feel tired

. You begin to skip steps. You fill around only 50% of the total fields. Your accuracy is not the same, your energy is not the same and definitely, your steps are not the same.

And one day, the client reports the same bug in the same form. You feel pathetic. You feel unconfident now. You think you are not competent enough. Managers are questioning your ability.

I have a news for you; this is the story of 90% of the manual testers out there. You are not different.

Regression issues are the most painful issues. We are humans. And we cannot do the same thing with same energy, speed and accuracy every day. This is what machines do. This is what automation is required for, in order to repeat the same steps with the same speed, accuracy and energy as they were repeated the first time.

I hope you get my point!!

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.

Scenarios which require Automation

The above scenario is not the only case when you will need automation testing. There are several situations, which cannot be tested manually.

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.

Manual Test Case Steps:

  1. Launch Calculator
  2. Press 2
  3. Press +
  4. Press 3
  5. Press =
  6. The screen should display 5.
  7. Close Calculator.

Automation Script:


//the example is written in MS Coded UI using c# language.
[TestMethod]
public void TestCalculator()
{

//launch the application
var app = ApplicationUnderTest.Launch("C:\\Windows\\System32\\calc.exe");

//do all the operations
Mouse.Click(button2);
Mouse.Click(buttonAdd);
Mouse.Click(button3);
Mouse.Click(buttonEqual);

//evaluate the results
Assert.AreEqual("5", txtResult.DisplayText,”Calculator is not showing 5);

//close the application
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.

What are Assertions?

The second last line of the script needs some more explanation.

Assert.AreEqual(“5”, txtResult.DisplayText,”Calculator is not showing 5);

In every test case, we have some expected or predicted result at the end. In the above script, we have an expectation that “5” should be shown on the screen. The actual outcome is the result that is displayed on the screen. In every test case, we compare the expected outcome with the actual outcome.

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.

Upcoming ones in this series:

In our upcoming tutorials, we will discuss several aspects related to automation.

These include:

  1. Types of automated tests and some Misconceptions.
  2. How to introduce automation in your organization and avoiding common pitfalls when doing test automation.
  3. The tool selection process and comparison of various automation tools.
  4. Script Development and Automation Frameworks with examples.
  5. Execution and reporting of Test Automation.
  6. Best Practices and Strategies of Test Automation.

About the author: Many expert authors from our STH team have worked on this complete series. Mohammad S, worked on this tutorial. He is working as a Test Automation Lead in a leading MNC.

Are you eager to know more about each and every concept of Automation Testing? Watch out and stay tuned to our list of upcoming tutorials in this series and feel free to express your thoughts in the comments section below.

NEXT Tutorial#2