Test.AI is a powerful Visual Studio Code extension designed to simplify the process of creating Behavior-Driven Development (BDD) tests for software. By leveraging generative AI and agents, Test.AI converts .andes files into Gherkin .feature files and auto-generates corresponding step definitions. This automation significantly reduces the time and effort required to develop comprehensive BDD tests.
Features
Conversion of .andes Files to Gherkin: Automatically transforms user stories described in .andes files into Gherkin .feature files.
Step Definition Generation: Generates step definitions for the .feature files to streamline test development. Currently, step definitions are generated exclusively for C#, with plans to support additional languages in the future.
AI-Powered Automation: Utilizes large language models (LLMs) to ensure high-quality and context-aware test generation.
Seamless Integration: Works directly within Visual Studio Code, providing a smooth development experience.
Installation
Open Visual Studio Code.
Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or pressing Ctrl+Shift+X.
Search for Test.AI.
Click Install.
Getting Started
Prerequisites
.andes files describing user cases in the expected format.
An active internet connection for AI-based generation.
A .env file in the root folder of your VS Code project containing the following variables:
DTO_SOURCE: The full path to the DTO files directory in your project.
SWAGGER_PATH: The full path to the Swagger document of your project.
LLM_MODEL: The AI model chosen by the user.
API_KEY: The API key for the AI model being used.
Usage
Open a .andes file in Visual Studio Code.
Right-click on the file and select Generate BDD Tests with Test.AI.
The extension will:
Create a corresponding .feature file in the same directory.
Generate step definitions and save them in a designated folder (steps/ by default).
Review and refine the generated tests as needed.
Commands
Generate BDD Tests: Converts .andes to .feature and generates step definitions.
Configure Test.AI: Opens the configuration settings for the extension.
Configuration
You can customize the extension settings in VS Code:
Output Directory: Specify the folder where step definitions should be saved.
LLM Model: Select the AI model for generation (if applicable).
Logging: Enable or disable logging for debugging purposes.
Example
Input (example.andes):
[User Story]
As a user, I want to log in to my account so that I can access my dashboard.
[Acceptance Criteria]
- Given I am on the login page
- When I enter my username and password
- And I click the login button
- Then I should see the dashboard.
Output (example.feature):
Feature: User Login
Scenario: Successful login
Given I am on the login page
When I enter my username and password
And I click the login button
Then I should see the dashboard.
using TechTalk.SpecFlow;
[Binding]
public class ExampleSteps
{
[Given("I am on the login page")]
public void GivenIAmOnTheLoginPage()
{
// Add implementation here
}
[When("I enter my username and password")]
public void WhenIEnterMyUsernameAndPassword()
{
// Add implementation here
}
[When("I click the login button")]
public void WhenIClickTheLoginButton()
{
// Add implementation here
}
[Then("I should see the dashboard")]
public void ThenIShouldSeeTheDashboard()
{
// Add implementation here
}
}