Home Guide Automation Testing Guide: Getting Started

Automation Testing Guide: Getting Started

Shreya Bose, Technical Content Writer at BrowserStack -

Why is Automation Testing critical in a Software Lifecycle?

Imagine this.

On your first day as a QA, you have to test an application that includes about 100 fields that require input. When conducting exploratory testing, you have to insert input manually in each field. This takes about 10 minutes to do if you are really fast.

You press Submit. An error message appears. It looks like an unhandled exception. You report the bug and feel really good about a job well done. You repeat the process, find a few more bugs and have a generally productive first day.

The next day, the developer fixes the issues and you have to test the new version of the software, repeating the same steps as the day before. Bug fixed. Job well done. A good user experience ensured, thanks to your efforts.

On the third day, developers have released a newer version with newer features. But in order to ensure that the new features have not broken the older working features, you have to repeat the process again. No issues found.

A month onwards, developers are releasing newer versions continuously, which means you have to keep testing the software, repeating the same process (inserting field input) every time. You are bored and tired. Your accuracy begins to waver, as a result of which you eventually end up missing a bug – possibly a rather obvious one.

Believe it or not, this is a fairly common scenario for most QAs. It is not possible to do the same thing over and over again and be perfect at it every time. This is where automation testing comes in.

Can a software test another software?

Yes. That is the whole point of automation testing. When it comes to regression testing, investing manual effort is futile and wasteful. Instead of expecting humans to repeat the same steps with the same speed, accuracy and energy, it is far more logical to program a machine to do the same.

What tests should be automated?

Before creating an automation strategy, let’s have a look at which tests are most feasible for automation:

  • Regression Testing: Regression suites are ever-increasing, and require the same variables to be filled numerous times to ensure that new features do not tamper with older functions. This can easily be automated.
  • Testing of complex functionalities: Automate all tests requiring complex calculations, something prone to human error.
  • Smoke testing: Run automated suites to verify the quality of major functionalities. This saves time by offering a quick analysis of whether a build requires more in-depth testing.
  • Data-driven testing: Automate tests to validate functionalities that must be tested repeatedly with numerous data sets.
  • Performance testing: Automate tests that monitor software performance under different circumstances. Doing this manually would be extremely painstaking and time-consuming.
  • Functional testing: Every time a developer submits a PR, functional testing needs to be executed quickly and provide immediate feedback. This is impossible to achieve without automation, especially as organizations scale up.

Getting Started with Automation Testing

When transitioning from manual to automation testing, keep the following points in mind:

  • Do not aim for 100% test automation. Not all tests can be automated. Even among tests that can be automated, do not set an initial target of complete automation.
  • Set a realistic goal. For example, start by moving a few tests to automation. Write smaller test cases that can be easily reused in future tests of the same software. Map test cases with corresponding functions to provide better test coverage. Label test cases so that teams can have clarity on what to automate as well as report more effectively.
  • Explore new areas of the application with automation. When chalking out automation strategies, ensure that business requirements are taken just as seriously as technical considerations.
  • Know what not to automate. This helps to decide the scope of automation early in the ideation process. The following tests are best left to manual coverage:
  1. User experience testing: Tools cannot replicate any user journey in its entirety. It is impossible for an algorithm to predict how individual users will interact with an application. In order to actually judge the quality of user experience, stick to human testers. Try using manual interactive testing tools like BrowserStack Live.
  2. Accessibility testing: When testing how accessible an application is, there is no substitute for human usage. A tool cannot measure accessibility because every people often have different opinions on what counts as accessible. It is not possible for a tool to recognize if software workflow is providing easy access for actual humans.
  • Select the right tools

Automation testing is entirely dependent on tools. Here’s what to consider when choosing the right tool:

  1. The nature of software: Is the application being tested web-based or mobile-based?
    To test the former, use a tool like Selenium to automate your tests. For the latter, Appium is one of the best possible tools for automation.
  2. Programmer Experience: Choose frameworks, languages, and tools that match testers’ comfort and experience. Some of the most popular languages used for automation testing include Java, JavaScript, Ruby, C#, etc.
  3. Open Source or not: Depending on budget constraints, one may choose to use open-source tools such as Selenium or Appium for automation purposes. However, it is important to remember that all open-source tools are not inferior to their commercially available counterparts. For example, Selenium Webdriver is an open-source tool that is most highly favored by automated testers around the world.
  • Select the right test grid

The test grid refers to the infrastructure that all automated tests will run on. It comprises a series of devices, browsers and operating systems (multiple versions) that software is to be tested on. It is always best to automate tests on real devices and browsers. This will ensure that software is being tested in real user conditions.

Additionally, the ideal test grid should enable parallel testing. This means that testers should be able to run multiple tests on multiple devices simultaneously. This cuts down on test time, expedites results and offers results within shorter deadlines.

Something else to decide is whether the test grid should be hosted on-premise or on the cloud. Keep in mind that an on-premise infrastructure is almost always expensive to set up and maintain. It requires keeping track of new devices, browsers, and operating systems, updating and maintaining them accordingly. This is a challenge since multiple versions of each are released every month.

Conversely, testing on a cloud-based grid is easier, since updating and maintenance would be taken care of by the organization offering the grid. For example, BrowserStack offers a cloud Selenium grid that is connected to 2000+ real devices and browsers for testing. Users simply have to sign up and start testing on a robust Selenium grid that is being constantly updated for the best possible results.

Get Started Free with BrowserStack Automate

Example of Test Automation

When manually testing software, the tester uses a mount and keyboard to interact with it. Automation scripts and tools replicate this interaction, step-by-step.

In this example, a calculator is being tested to see if it can add two numbers and display the result. Manually, the steps to do so would be the following:

Step 1: Launch Calculator
Step 2: Press 2
Step 3: Press +
Step 4: Press 3
Step 5: Press =
Step 6: The screen displays 5
Step 7: Close Calculator

An automation tool can perform the same steps with the following 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();
}

When executing the above script, the exact same result (5) is displayed. Instead of having to go through the manual steps, simply write the script and let the tool take care of the rest.

How to move from Manual to Automation Testing?

To begin with: ask two questions.

  1. What to Automate?
  2. How to Automate?

What To Automate?

  • Automate tests necessary for a frequent release cycle. That may include smoke tests, regression tests and the like. Basically, automate tests that speed up the entire test cycle. Remember, lower manual intervention equals faster results.
  • Automate tests based on technical and business priority. Think like this: would the automation of this test help the business? Would automate this test help simplify technical complexities? If the answer is yes to either question, automate.
  • Automate based on usability. Some tests, such as cross browser compatibility tests simply work better when performed manually. Tool dependency can also limit automation potential for a certain testing team or organization.

How To Automate?

To start with, keep in mind that not all tests can be automated. By adhering to the three strategies in the previous section, it becomes easier to initiate automated testing in a practical manner.

  • Start small. 100% automation is not the goal, and also not possible. Write smaller test cases because they are easier to maintain and reuse. Move a small number of tests to an automation platform, run the tests, analyse the results and decide if the process proved to be beneficial to the software development process.
  • If significant benefits do come from the operation, move more tests to automation. Start moving tests not only in volume but also increase the type of tests being automated. Remember that this is still an experimental stage. It is possible that certain tests will prove to be inefficient in automation, and have to be moved back to manual testing.
  • Map test cases with each method or function in order to gain better test coverage. Label your test cases for easier identification, so the team can quickly know which tests to automate. This also helps implement better reporting.
  • When starting automation testing start by exploring new areas of the application via manually. Then, create a risk plan that detail what needs to be automated, based on business and technical priorities.
  • Use analytics to determine end-user preferences. Create a list of browsers and devices that users are most likely to access the software with. This helps automation testing cover the right interfaces and optimizes software performance on the right user avenues.

Try Automated Testing on Real Device Cloud

Automation testing is an integral part of any testing ecosystem. Without moving to an automation setup, comprehensive testing becomes difficult, as do the meeting of ever-shortening deadlines. Consequently, it is important to initiate automation testing protocols as early as possible in a way that balances and complements manual testing.


Interesting Read on Manual vs Automation Testing: Differences


Try the steps outlined above, and experiment enough to find out which approaches yield optimal results. Don’t be worried to fail a few times before finding the sweet spot that allows effective automation without compromising human validation.

BrowserStack Logo Run Selenium Tests on 2000+ Browsers & Devices Get Started Free