Test Creation using Record and Playback Testing

Test Creation using Record and Playback by TestGrid

The world of software development is progressing each day, where applications are constantly evolving and new features are continuously being added, ensuring software quality is of utmost importance. In such a scenario, manual testing can be time-consuming and error-prone. And that is where automation testing comes to the rescue and helps achieve an efficient and reliable testing approach.

Though automation testing is a great solution, it comes with its own set of challenges. The most common challenge that one can face is the availability of resources that can adapt to an automation testing tool with very little turnaround time. To overcome this, the Record and Playback feature of automation testing tools can be a game-changer. In this article, we will discuss about Record and Playback feature to perform test automation and see how TestGrid offers a seamless platform to use it.

What is Record and Playback Testing?

Record and Playback Testing is a technique to record scripts for the actions performed by the user. The script can be re-run or played back to simulate the same actions with the application. The recorded script is capable of capturing different user actions or interactions like mouse clicks, key presses, window navigation, etc similar to the interactions offered by various automation testing tools.

Record and Playback is generally done through a user-friendly interface that allows testers to easily record their interactions, and then play back the recorded script to validate the application’s functionality.

Benefits of using Record and Playback Testing

Record and Playback testing comes with several advantages like-

  • Fast test creation by recording user actions can significantly reduce the time and effort invested in the test development process, be it manual or automation testing.
  • Record and playback enable teams to develop comprehensive test cases, hence increasing the test coverage.
  • The maintenance effort is reduced marginally, as the user can re-record the changed user flow or scenario, hence minimizing the effort required to maintain the test suite.
  • Record and playback testing can be easily adapted by non-technical testers or business analysts to create and execute automated test scripts, eliminating the need to learn any programming language.
  • Regression tests can be created using the record and playback feature and executed multiple times to validate functionality after any code change in the application.

Challenges with Record and Playback Testing

Not everything comes without challenges, and so is the case with Record and Playback Testing. It comes with a fair share of challenges that need to be addressed to maximize its benefits.

  • The recorded scripts can be fragile and may break if there are changes in the application’s User Interface(UI) or element properties. If your project has such frequent updates, it is necessary to frequently update the recorded test scripts too.
  • Recorded scripts might have limited flexibility to handle complex scenarios or conditions, In such cases, you might have to apply customized logic or use data-driven approach in your test scripts.
  • Testing dynamic content using record and playback can be challenging as the chance of accuracy is less when the data changes during playback.
  • Since the recorded tests may contain hard-coded data, executing data-driven tests can be challenging.
  • With the growth of applications, maintaining scalability can be a real challenge because of limited reusability within tests.

These challenges can be overcome by using Record and Playback testing with other techniques like scripting, or a keyword-driven approach to ensure maintainability of tests.

Record and Playback Testing Using TestGrid

Now that we know what record and playback testing is and how it can help in scaling automation testing for an organization, let us see how TestGrid’s Record and Play feature can help us ease our automation challenges.

Recording Web Application Test Scripts

TestGrid offers an easy approach to recording test cases by simply executing them as you would have done manually. These recordings are precious scripts that can be reused to test the application without the need to write a single line of code. Let us look at how we can do that practically for the below use case-

  1. Open the demoqa website.
  2. Enter a valid username.
  3. Enter a valid password.
  4. Click on the Login button.
  5. Log out from the dashboard.

We will now see the steps to perform record and playback testing using TestGrid.

  1. Login to your TestGrid account and navigate to the Codeless tab from the left panel.
Selecting Codeless

2. Now, click on Create a New Project to see a window popping up. Enter the Project Name and select the type of project you would want to create. We are creating a Web Project, hence selecting the Web radio button. Additionally, enter the test suite name if you wish to create one within the project.

Record new test case- add project

3. Click on Next and you will see the screen where you can enter your test case details. Enter the test case name, its description, and the URL of the web application that you will be testing.

Record New Test Case - Test Case Details

4. Select the browser that you would want to write your tests on. Click on the Start Writing Test Case button.

Record New Test Case - Devices/Browsers

5. You will be redirected to a new window where you will see that the web page of the application entered by you previously can be seen. On the right part of the screen, you will be able to see the Element and Steps-related details.

Record & Play feature screenshot

6. Now, TestGrid provides you with a unique feature of recording your test case, which can be done by clicking on the Start Recording button on the left side of the window. Click on the Start Recording button and voila whatever actions you perform will be recorded after it. You will notice that the Start Recording button now shows Stop to stop the recording.

Stop Recording button

7. We will now enter the username in the username field. Once you do that, you will notice that the Actions on the right side of the window get auto-populated with the elements and parameters.

image6 1

Note that you can edit the parameters or even edit the steps if required. For example, I am changing the screenshot capturing for the first three steps.

changing the screenshot capturing

8. Similarly, we will enter the password and see the step details getting auto-populated.

Record & play - Auto-populating details

9. Now we will be clicking on the Login button.

image17 2

10. You can see that the user has successfully logged in. Finally, we will be clicking on the Logout button and stopping our test recording.

Login test record

11. We now have all our test steps recorded, you can either run them and see if the execution is as per expectation or can directly Save the test case to execute it later. Let us Run the test case we just recorded to see that it is running as we recorded.

Running the recorded tests

You will see that the test execution starts on the Grid and the corresponding logs are displayed. Additionally, you can see the live execution of your test on the left side of the window. 

12. Once the execution is complete you can see the successful status in the logs.

Test Success

13. Now go ahead and Save your Test Case to be reused for later runs by clicking on the Save button.

Save your Test Case

You may close the window and go back to the Dashboard to see your recorded test.

record and play dashboard

And that is how you can create test scripts for different test scenarios for your application. You can select from the different web browsers available to automate the scenarios. 

Recording Mobile Application Test Scripts

We just saw how easily tests can be recorded for web applications. But this is not enough, TestGrid offers the feature to record test cases for mobile applications as well. You may select an Android or iOS device as per your requirement and automate the app of your choice. For this demo, we will be using a simple calculator app on an Android device to automate the below use case-

  1. Open the Calculator app.
  2. Perform the addition of two numbers.

You can create a new project as shown in the above part or add a new version to your existing project for the Mobile application. I have added a new version for Android in the same project for the demo.

Adding new version for Android in the same project

I have created a Test Suite within the Version and I will now be recording my test.

image8
  1. Upon clicking the Record a New Test Case button, you will see a pop-up window asking for details of the test. I have uploaded the calculator apk and entered other required details.
Record a New Test Case
  1. On clicking on the Next button, you will be able to see a list of available devices, select a device as per your convenience, and click on the Start Writing Testcase button.
list of available devices
  1. A new window will open up where you can see the mobile device with the application on the left side of the window, and the test case, elements, and steps on the right side of the window. You will also see a Start Recording button on the left side, just as we saw for Web Applications. Click on the button to start recording your tests.
Start Recording button
  1. As soon as you click on the Start Recording button, the Element picker section is frozen and you can see the Stop button to stop recording your test.
button to stop recording your test
  1. Let us tap on one number and see the corresponding step recorded on the right pane.
image5 2
  1. Let us now tap on the ‘+’ sign and see the corresponding steps being added.
Dashboard- see the corresponding steps being added
  1. Similarly, we will tap on another number.
Dashboard screenshot- TestGrid
  1. Finally, we will tap on the ‘=’ sign to see the final result.
Record and play dashboard screenshot

I am further customizing my script to validate the result. For that, I will first stop the recording and try to capture the element that displays the final result and validate the value it contains. On saving the test you can see the steps in the test case.

The steps in the test case

 You can now execute this test as and when required to see the successful addition of two numbers.

Execute the test

And there you go! You have easily automated tests for web as well as mobile applications using the Record and Playback feature of TestGrid. You can also leverage the different reports to see your executions offered by TestGrid to get insights into the executions. You can view the Build Summary that shows the number of tests that passed or failed in a build as well as the Steps and the execution time for the.

Build Summary - TestGrid

The Network Log report highlights the network logs including the transactions that happened over the internet while executing the test script.

TestGrid Network Log report

The Transaction Analysis report gives insights into the Performance benchmarks.

Transaction Analysis report in testgrid

Key Takeaways

  • Record and Playback Testing can be a game-changer to boost the automation testing strategy for an organization.
  • Recording the tests is as easy as executing manual tests and re-running the recording to validate the features.
  • Record and Playback testing offers multiple advantages, ranging from fast test writing to easy adoption by non-technical team members.
  • It also has some challenges like maintainability issues, which can be addressed by using it in conjunction with other techniques of automation testing.
  • TestGrid provides an amazing solution to record your web or mobile tests that can be run on the TestGrid server across multiple browsers or devices.
  • The Record and Playback feature offered by TestGrid helps to generate test cases in no time and execute them over a range of devices/browsers along with providing comprehensive reports of execution.