Debugging Test Scripts in Visual Studio Code
Learn how to debug a BlinqIO scenario using Visual Studio Code (VS Code).
Prerequisites
Ensure the following before debugging a scenario in VS Code:
- You have an implemented scenario using GenerateAll, GenerateStep, Recorder, or API App.
- You have accepted any pending AI Oversight suggestions for the code you wish to debug.
Add a Unique Tag to the Scenario
Go to the scenario you want to debug, click Edit, and add a unique tag, such as
debug
.
Generate and Copy the Run Command for the Scenario
Generate a command-line run command for the scenario using the unique tag you added.
Navigate to the Reports page.
Click How to run scenarios. The Run Instructions page will be displayed.
Select the tag you added from the tags dropdown.
Copy the last command from the Run Instructions. You’ll need this command in the next steps.
Example command:
npx cross-env BLINQ_ENV=environments/prod.json TOKEN=56c0dsdda3fb1b7b8c86af21f021c3c5 BVT_FORMATTER="ANALYSIS" cucumber-js --format bvt --tags "@test"
Open the Project in VS Code and Start Debugging
Follow these steps to start debugging your automation script in VS Code:
On the Project page, click the three-dot menu and select Open in VS Code. This syncs the BlinqIO project to your local system and opens it in VS Code.
Open the automation script (
.mjs
) in VS Code and add a breakpoint on a line within a function.Open the VS Code terminal by selecting View > Terminal from the menu bar or by pressing Ctrl+`.
Open the JavaScript Debug Terminal by selecting Create JavaScript Debug Terminal from the terminal switcher dropdown.
Run the previously generated command in the JavaScript Debug Terminal. The test will start executing with the debugger attached and will pause at any breakpoints you've set.
For more information on debugging options in VS Code, see the VS Code Debugging Documentation.