- Here is a video tutorial
Let’s revise the tutorial to specifically focus on using Visual Studio Code with the Gauge, ESLint, and Babel JavaScript extensions for running and managing the test. This adjustment will align the tutorial with your video presentation that demonstrates executing the setup and tests directly from Visual Studio Code.
Creating and Running Automated Tests in AWX with Gauge and Taiko in Visual Studio Code
Welcome to this detailed tutorial where we will create and run an automated test for logging into the AWX management interface using Gauge and Taiko in Visual Studio Code. This guide will walk you through setting up your test environment, creating spec and JavaScript files, and executing the testโall within Visual Studio Code.
Prerequisites
Make sure you have the following installed:
- Node.js
- Gauge
- Taiko
- Visual Studio Code with Gauge, ESLint, and Babel JavaScript extensions
Step 1: Set Up Your Visual Studio Code Environment
- Open Visual Studio Code and create a new project folder named
awx-tests
. - Open the terminal in Visual Studio Code by selecting
Terminal
>New Terminal
from the top menu. - Initialize a Gauge JavaScript project within this folder by running:
|
|
This command creates a basic project structure with example specs and supporting files that are useful as starting points.
Step 2: Explore and Modify Example Files
Navigate through the files in the Explorer pane of Visual Studio Code. Look at the example spec and JavaScript files to understand the basics of Gauge and Taiko interactions.
Step 3: Create a New Spec File
- Create a new file called
test-awx.spec
in thespecs
directory. - Define the spec with a scenario that describes the steps to log into AWX:
|
|
Step 4: Implement the Steps in JavaScript
Create a corresponding JavaScript file named awx-steps.js.js
in the tests
directory:
- Set up the necessary imports and Gauge annotations:
|
|
- Define pre-test and post-test behaviors:
|
|
- Script the test steps based on your spec definition:
|
|
Step 5: Run Your Test from Visual Studio Code
- Save all files and ensure your project structure is correct.
- Run the test by opening the Command Palette (
Ctrl+Shift+P
) and typing ‘Gauge: Run All Specifications’. This command will execute all your specs and display the results directly in Visual Studio Code, or just click Run spec or scenario (available in Visual Studio Code after installation of the Gauge extension).
Conclusion
This tutorial guided you through creating and executing an automated login test for AWX using Visual Studio Code, Gauge, and Taiko. By leveraging Visual Studio Code extensions like Gauge, ESLint, and Babel JavaScript, you can streamline your test development and execution process.