Scriptless/Codeless Debugging
Overview
Debugging is an essential skill for automation testers, ensuring that automated test cases function correctly and do not result in false positives or negatives. Effective debugging enhances the confidence and capabilities of testers, leading to better code solutions and faster issue resolution. TestGrid now offers enhanced debugging features for codeless steps, providing a unified UI with clear error expressions and fixes. This enables users to write more accurate automation scripts, reducing time and facilitating quicker transitions to autopilot.
Various Techniques for Debugging Test Automation Scripts Using TestGrid Codeless
Automated test cases may not always run smoothly due to changes in the application’s UI or business logic. Test script failures can stem from bugs in the application itself, not just from issues in the automation framework. Proper assertions are crucial for identifying the root cause of test case failures before delving into advanced debugging techniques.
When developing a Selenium/Appium Test Automation framework from scratch, importing utilities that aid in debugging the source code is vital. Debugging becomes challenging with only console log output during failures. Here are some techniques to ease the debugging process for developers and testers:
1. Debugging with Logging Utilities
Logging utilities allow testers to output various logs based on the target. Enabling logging helps pinpoint the exact location of buggy code when issues arise in the test scripts.
2. Executing Codeless Steps One at a Time and Verifying with Logs
This advanced debugging method is useful when the execution time of a regression suite is too long to monitor continuously. By enabling the execution of one step at a time, testers can save time and focus on specific steps for debugging purposes.
3. Adding Breakpoints
Breakpoints can be set on any codeless step to halt the execution. When the execution pauses at a breakpoint, testers can gather data on essential elements in the source code. Debugging with breakpoints involves the following steps:
Set breakpoints where buggy test automation steps are observed.
Execute the test script in debug mode.
Validate the data returned in debugger logs.
Resume debugging if multiple breakpoints are added and run the steps.
Stop the debug mode execution and run the steps.
Fix errors and rerun or debug single or all test steps in a codeless manner.
Note: Debugging is supported on the Test Case Generator screen while writing a test case.
Step 1: Start a New Test Case
- Go to the Codeless Project.
- Click on the “Record New Test Case” button to start creating a new test case.
Step 2: Write Your Test Case
- Once the Test Case Generator screen appears, write the steps for your test scenarios.
- Complete the test case by adding all the necessary steps.
Step 3: Debug Your Test Case Steps
- You will find a “Save” button beside a “Debug” button.
- Click on the “Debug” button to run all the written steps.
- The status of each step will be reflected on the same screen.
- A green icon indicates a successful step.
- A red cross icon indicates a failed step and a red line indicates that it is not supported.
- You can stop the debugging process at any time.
- Debug steps one at a time and check the logs at the bottom of the screen to verify the output.
- You can also see the live execution of debug steps on the left-side panel.
Step 4: Add a breakpoint to your test case steps.
- Once the Test Case Generator screen appears, write the steps for your test scenarios.
- Breakpoints can be set on any codeless step to halt the execution. When the execution pauses at a breakpoint, testers can gather data on essential elements in the source code.
- After clicking the Continue button, the further execution will run successfully.
- The following keywords are not supported in Phase 1.0 for Android, iOS, and the web:
Web: Call Test Function, Call Network Assert, Print Log, Increase, Clear Network Logs, Custom Expression, Take Full Screenshot, Repeat If, End If.
Android & iOS: Call Test Function, Call Network Assert, Print Log, Increase, Clear Network Logs, Custom Expression, Take Full Screenshot, Repeat If, End If, Relaunch App.
Happy Testing!