Skip to main content

Behavior-Driven Development (BDDs)

Creating and reviewing behavior-driven development (BDD) processes with StackSpot AI

Behavior-Driven Development (BDD) is a methodology that aims to enhance team communication by employing practices that depict software behavior in an agile and direct manner. BDD promotes collaboration among business, development, and quality teams, enabling them to exchange ideas and address the difficulty osf making tests and software more comprehensible.

Using StackSpot AI extension in Visual Studio Code to write, suggest improvements, and apply best practices to your BDD when writing in Gherkin. The steps below show an example of how to do it.

Steps

  1. Open the StackSpot AI extension on your IDE and create a BDD based on software specifications. See the example:
Software History Specification

Title: Search for the term "How to use StackSpot" on mobile using the Google Chrome browser

As an interested user, I want to perform a search for the term "How to use StackSpot" on my cell phone So that I can learn how to use the StackSpot platform through the Google Chrome browser.

Acceptance Criteria:
Browser accessibility:

Given that I have a cell phone with the Google Chrome browser installed,
When I open the browser,
Then, I should be able to access the address bar.
Search performance:

Given that I'm on the Google Chrome homepage,
When I type "How to use StackSpot" into the address bar or Google search bar,
And press the search button or "Enter,"
Then, I should see a list of results related to the search term.


Access to Content:

Given that search results are displayed,
When I click on one of the results that seems to provide information on how to use StackSpot,
Then, I should be redirected to the corresponding page,
and read the details on how to use the StackSpot platform.
Usability on Mobile Devices:

Given that I have accessed a page with information on how to use StackSpot,
When I browse the page,
Then, the content should be displayed in a readable way and adapted to my mobile screen,
I can easily interact with any interactive elements, such as links or buttons.

Visual feedback:

Given that I am interacting with the page,
When I select a link or button,
Then, visual feedback, such as a color change or a click effect, should indicate my action.

Notes:
The search must be done using a stable internet connection to avoid loading problems.
The user should ensure that the Google Chrome browser is up to date for the best possible experience.
This story does not cover specific instructions on installing Google Chrome on mobile devices, assuming the user already has the browser installed and ready to use.

Out of Scope:
Installing the Google Chrome browser on a cell phone.
Troubleshooting internet connection problems.
Specific actions within the StackSpot website after finding the desired information.

  1. Then, type “Create a BDD in Gherkin language for the selected story“ in the StackSpot AI extension chat. See the example:
  • Story
Title: Search for the term How to use StackSpot on mobile using Google Chrome browser
As an interested user, I want to perform a search for the term How to use StackSpot on my cell phone so that I can learn how to use it.

Acceptance Criteria:
Browser Accessibility

Given that I have a cell phone with the Google Chrome browser installed, I should be able to access the address bar when I open the browser.

Search performance:
Given that I'm on the Google homepage, when I type How to use StackSpot into the address bar or Google search bar and press the search button or `Enter, ' I should see a list of results related to the search term.

Access the content:
Given that search results are displayed, when I click on one of the results that provide information on how to use StackSpot, I should be redirected to the corresponding page and be able to read the details on how to use the StackSpot platform.
Usability on mobile devices

  1. StackSpot AI generated a complete BDD based on the functional story. Example:
# language: en
Functionality: Search for the term "How to use StackSpot" on mobile using the Google Chrome browser
As an interested user
I want to search for the term "How to use StackSpot" on my cell phone
So that I can learn how to use the StackSpot platform through the Google Chrome browser

Context:
Given that I have a cell phone with the Google Chrome browser installed

Scenario: Browser accessibility
When I open the browser
Then, I should be able to access the address bar

Scenario: Performing the Search
Given that I'm on the Google Chrome homepage
When I type "How to use StackSpot" into the address bar or Google search bar
And press the search button or "Enter."
Then, I should see a list of results related to the search term.


Scenario: Access to Content
Given that search results are displayed
When I click on one of the results that seems to provide information on how to use StackSpot
Then, I should be redirected to the corresponding page
And be able to read the details on how to use the StackSpot platform

Scenario: Usability on Mobile Devices
Given that I have accessed a page with information on how to use StackSpot
When I browse the page
Then, the content should be displayed legibly and adapted to my mobile screen
I should be able to interact with any interactive elements, such as links or buttons, without difficulty

Scenario: Visual Feedback
Given that I am interacting with the page
When I select a link or button
Then, there should be visual feedback indicating my action, such as a color change or a click effect

Improve your existing BDD

If you already have one BDD, use StackSpot AI to rewrite and improve it.

  1. Add the example below in the chat and ask StackSpot AI: “Review and refactor the selected file using BDD best practices.”

#language: en
@Improving_your_bdd_with_StackPot_IA
Feature: Trading via the Mobile Cash app

Context: User with trading permission
Given that I am logged in to the Mobile Cash application
And have permission to renegotiate contracts
And I have contracts to negotiate
And I click on the menu access
Click on the negotiation
And wait for the negotiation area to load

Scenario: CT01 - Access to the negotiation menu
Then, the application must allow access to the negotiation menu

Scenario: CT02 - Access to the negotiation menu
When I click on negotiate
Then, the application should redirect to the list of contracts available for trading.

Scenario: CT03 - Access to the settle contracts menu
When I click on settle contracts
Then, the application should be redirected to the contracts available for settlement.

Scenario: CT04 - Access to the Blocked Contracts menu
When I click on blocked contracts
Then, the application should redirect to the list of contracts blocked for renegotiation.

Scenario: CT05 - Validate the negotiation
When I click on negotiate
I access the list of contracts
I choose a contract
And I click on the choice checkbox
And I click on the Select Contracts button
I check the negotiation conditions
I chose the conditions I wanted, with a down payment of 1000 reais and the rest in 12 installments.
Click on Negotiate a contract.
Then, the application should show a success screen for the negotiation that is carried out.

  • The result is:

#language: en
@Improving_your_bdd_with_StackSpot_IA
Feature: Trading via the Mobile Cash app

Context: User with trading permission
I am logged in to the Mobile Cash application with the username “user_test” and password “password_safe.”
And have permission to renegotiate contracts
And have contracts to trade listed in the “Available Contracts” section
When I access the main menu
Select the “Negotiation” option

Scenario: CT01 - Access to the negotiation menu
Then, the application should display the negotiation area with the options “Negotiate,” “Settle Contracts,” and “Blocked Contracts.”

Scenario: CT02 - Accessing the negotiate menu
When I select the “Negotiate” option
Then, the application should display the list of contracts available for negotiation


Scenario: CT03 - Access to the Settle Contracts menu
When I select the “Settle Contracts” option
Then, the application should display the list of contracts available for settlement

Scenario: CT04 - Access to the Blocked Contracts menu
When I select the “Blocked contacts” option
Then, the application should display the list of contracts blocked for renegotiation

Scenario: CT05 - Validate the negotiation of a contract
Given that I am on the list of contracts available for negotiation
When I select a contract with the ID “12345”.
And mark the contract for negotiation.
I select “Select Contracts.”
I also set the negotiation conditions for a down payment of 1000 reais and the rest in 12 installments.
And confirm the negotiation.
Then, the application should display a success message: “Negotiation completed!”

Scenario: CT06 - Negotiation attempt without contract selection
Given that I am on the list of contracts available for trading
When I try to trade without selecting a contract
Then, the application should display an error message: “Select a contract to trade.”

Scenario: CT07 - Checking for invalid trading conditions
Given that I am on the trading conditions screen for the contract with ID “67890.”
When I enter an invalid entry of “-500” Reais
And try to confirm the trade
Then, the application should display an error message: “Invalid entry. Please enter a positive value.”


  1. Now, just review the content generated by StackSpot AI and done!

StackSpot AI enhances the creation and refinement of BDDs, streamlining test automation. It also improves communication within software engineering teams, offering tangible benefits and standardizations that simplify complex business processes.

Video & Blog