In our last blog, we outlined a descriptive guide to choosing the right BDD tools that address all issues with BDD. Once, the user is aware of what pointers to keep in mind to overcome the challenges while choosing the right strategy, half the work is done. The next logical step is to select a tool that is easy to learn and use. Let us recap the solution approach and delve deep into the top BDD tool we will showcase in this article. The tool will not only help you overcome the BDD challenges but empower you with automation, data integration, and other tool integration too.
Recap: The solution approach should make it easier for the three amigos to understand and verify the application’s behavior against business requirements and ensure that the scenarios defined during BDD sessions are directly translated into executable test scripts, promoting accuracy and efficiency. In this article, we will learn how you can tackle a BDD project with the use of Conformiq Visualizer.
Alright, but how can you address it? In this section, we will present a general overview of how you might deploy a Behavior Driven Development approach for your project, by using Conformiq Visualizer. Remember, with Conformiq Visualizer, your testing process will get much simpler and more efficient. So, let’s break up the main steps that you should take to address your next BDD project:
1. Define your System’s Behavior
- Gather Requirements: Start by gathering the behavior requirements from stakeholders. In BDD, these are often expressed in simple language that describes the expected behavior of the system.
- Write User Stories: Translate these requirements into user stories that describe the functionality from an end-user perspective.
- Specify Scenarios: For each user story, specify scenarios in a Given-When-Then format. Each scenario outlines a specific case of the user story, detailing the initial context (Given), the event or action (When), and the expected outcome (Then).
Example: Let’s consider a simple test that searches for images of water on Google. Below would be a reasonable test procedure:
To translate a test like this into Gherkin we must remember that one scenario will only cover one behavior. Therefore, we have two scenarios in the test following the Given-When-Then ordering, like this:
Feature: Google Searching Scenario: Search from the search bar Given a web browser is at the Google home page When the user enters "water" into the search bar Then links related to "water" are shown on the results page Scenario: Image search Given Google search results for "water" are shown When the user clicks on the "Images" link at the top of the results page Then images related to "water" are shown on the results page
Arguably, the first behavior scenario must run before the second, as the latter requires beginning at the search result page. However, the separation of these scenarios guarantees behavior-level independence, which ultimately represents software requirements (user stories) and acceptance criteria. We can directly write the Gherkin instructions in the code interface of Conformiq Visualizer:
The Golden Gherkin Rule: Write Gherkin in a way that treats other readers as you would want to be treated, ensuring that even those unfamiliar with the feature can understand it.
2. Create Models in Conformiq Visualizer
- Model the Feature: Use Conformiq Visualizer to create a visual model of your feature. This involves writing and linking blocks to express your scenarios.
- Incorporate Scenarios: Integrating the BDD scenarios into the model interface is automatic. By importing your Gherkin BDD scenario the Conformiq Visualizer will automatically create specific states transitions in the model that correspond to the Given, When, and Then steps.
- Validate the Model: Ensure the model accurately reflects the BDD scenarios and covers all the functional aspects described in the user stories.
Example: From the previous example of a test that searches for images of water on Google. Below is the model that Conformiq Visualizer creates automatically after adding the Gherkin code:
Conformiq Visualizer also allows you to design the model first and it will automatically write the Gherkin code for you. The models are created in the BPMN standard, which visually represents business processes that enable you to analyze your workflows.
A standard Business Process Model and Notation (BPMN) allows businesses to map out every step of their operations by using graphical models that everyone can read and understand. It takes a process-oriented approach, helping team members to quickly and easily adapt to new changes (either internal or B2B).
BPMN models make it easier to see how different organizations, users, and service providers work together and manage transactions
3. Export your Test Case Scenarios
- Automate Revert to Code: Use Conformiq Visualizer to automatically generate your Gherkin test cases from the graphical model. This software can interpret the scenarios modeled and produce detailed test cases that include necessary inputs, execution steps, and expected outcomes.
- Test Documentation generation: Analyze the generated test cases to ensure they cover all the scenarios defined in the BDD process. Adjust the model as needed to fill any gaps.
Example: Let’s take a look at the previous example again. Conformiq Visualizer allows us to import files with Gherkin code, to see it represented in the interface.
However, when our goal is to generate test cases from the models. We can simply export the Gherkin code into different formats such as:
- Gherkin
- Conformiq Creator
- PDF Files
- Excel
- BPMN Export
- SVG Export
If we select a PDF file, for instance, then we will get all the test cases to be covered. This tool is great when we are presenting large test cases in Acceptance Test Plans in front of a customer. Remember that we can also export the BPMN models, which would be great to introduce a feature to a non-technical audience, such as Project Managers or Final Users.
4. Insert Datasets into your Models
- Accurate Test Cases: This functionality allows users to import, create, and use specific data sets directly into their models for more accurate and comprehensive testing scenarios. Through Drag & Drop predefined data, you can ensure that the generated test cases are robust, covering various scenarios and edge cases that align with real-world data.
- Data Centralization: Central storage of all necessary data within the application, similar to a main desk in a library where all key information is kept. Gherkin files act like bookshelves containing scenarios (books) that describe different behaviors of the application, all based on the central data.
Example: Let’s consider an example in which data would be necessary for testing, such as the case of a user login scenario. After translating it into Gherkin, we should be able to describe the steps when a user tries to log into a website, as follows:
Feature: User login in a website
Scenario: Valid user login
Given a user exists with a <username> and <password>
|username|password|
|Alexis|123123|
When the user tries to log in with the correct credentials
Then the user should be successfully logged in
The username and password data would be linked to the centralized data storage, which guarantees consistency and simplifies maintenance. When you update a single piece of data only once, every associated Gherkin file automatically reflects this change. It makes your system’s BDD more efficient and manageable. In the code interface of Conformiq Visualizer, our instructions would look like this:
The data introduced in the model can be reviewed, updated, and exported:
5. Create Test Automation Files
- Automate Test Execution: The test cases generated by Conformiq Visualizer can be exported into automation script files (Step definition files). You can integrate these tests with your existing test execution environment or test automation frameworks.
- Collect and Analyze Results: Gather results from test executions to verify that the system behaves as expected across all scenarios. BDD is an iterative process, so you must use any failures or defects as feedback to refine the model and test cases. Repeat the process to continuously improve the quality and relevance of the test cases.
Example: For any given test case scenario that you created, Conformiq Visualizer will give you the option to convert it into automation script files. In the Automation panel, the previous example will look as follows:
6. Collaborate with your Team
- Collaborate Across Teams: Ensure that business analysts, developers, and testers are collaborating throughout the process, using the visual models and generated test cases as common reference points.
- Integrate with Development Workflows: Link the outcomes of your testing back into your development process, using tools like Jira, GIT, or other ALM tools to track bugs, feature requests, and enhancements.
Advantages of using ConformIQ Visualizer:
-
Ease of Using
Empowering new BDD users to speed up requirements using the Gherkin language. Easy guided approach through gherkin and model approach.
-
Experience Graphical Gherkin for BDD
A collaborative & visual BDD platform for business requirements and testing that offers intuitive visual design and real time synchronization of text, graphics and data.
-
Integrated With Essential Testing Applications
Offers Integration with testing applications for collaboration like Test Management, Jira, GitHub, Gitlab, Bitbucket, Azure DevOps and Cucumber JS and export test cases in multiple formats (PDF, Excel, BPMN, SVG).
-
Data Integration & CI/CD Ready
Manage data by easily importing, creating, and using data and graphics within test scenarios through Drag and Drop that accelerates releases through automation.
In summary, ConformIQ Visualizer makes it easier for the three amigos to understand and verify the application’s behavior against business requirements and ensures that the BDD scenarios are directly translated into executable test scripts. This not only promotes better collaboration but also the accuracy and efficiency of the users.
CTO, ConformIQ
You can connect with him at alexis.despeyroux@conformiq.com or through Linkedin