Skip to main content
Page Tittle
Business Driven Testing – The Way to Continuous Delivery
Images
continuous-delivery.png

In a fast paced environment, it is very important to have Continuous Delivery as the theme to deliver your releases as customers demand and also with the highest levels of quality. To get to continuous delivery continuous development and continuous testing backed by continuous integration are a first step. To achieve continuous development and testing, In this note we use Business Driven testing which is a piece of the larger methodology by Qentelli called Quality Driven Development, as the key first step. Let us now take a look at what it entails.

Business Driven Testing (BDT) is an approach to testing software that focuses on ensuring that it meets the needs of the business. Implementing BDT can offer several benefits to an organization, including:

  1. Improved alignment with business goals: By testing software from the perspective of the business stakeholders, BDT helps ensure that the software is delivering value to the organization and meeting the needs of its customers. This can help ensure that the software is aligned with the business goals and objectives.
  2. Increased efficiency: BDT can help reduce the time and effort required to test software by focusing on the most important business requirements and objectives. This can help speed up the testing process and reduce the risk of delays or defects in the software.
  3. Enhanced customer satisfaction: By testing software from the perspective of the customer, BDT can help ensure that the software meets the needs and expectations of the end users. This can lead to improved customer satisfaction and loyalty.
  4. Reduced risk: By testing software based on business requirements and objectives, BDT can help identify and address potential issues before they impact the business. This can help reduce the risk of defects in the software and improve the overall reliability of the system.

Meet Business Driven Testing (BDT) the way to Leverage ATDD Principles for Continuous Delivery

BDT is a component of Quality Driven Development (QDD™ by Qentelli). Behavior Driven Tests focusing on high level design not the technical implementation and not the technical terminology.

Business Driven Testing ensures test cases/stories are written in Given – When – Then style that makes it a natural language which are easily understandable to any persons like technical/non-technical.

BDT is open source framework available in many languages and it will be support different platforms: Cucumber, JBehave, NBehave, Speckflow, Behat and Twist.

We have to write the stories in the following format:

  • Given <An initial context>
  • When <Event Occurs>
  • Then <An outcome should be observed>

Involvement into BDT

Stakeholders or Users, Business Analysts, Testers, Developers will involve and perform their Respective roles.

BDT Notation:

  • Scenarios are designed to test.
  • Scenarios are grouped into features
  • Each scenario consists of   –Given   –When   – Then

Business Driven Testing Process Flow:

requirements-test-cases

Business analyst identifies the features as per the customer requirements.

  • Tester use cucumber features as test scenarios.
  • Tester writes test cases as behavior driven cucumber scenarios(user stories).
  • Developer writes code that makes test cases pass.
  • Test cases get automated by the testers.
  • Code is deployed and test executes their automated tests.
  • Bugs will get fixed, automated tests run as regression tests.
  • When done customer/user accept the software (Acceptance and quality criteria met).

Advantages and Challenges:

  • Easy understandable by the stakeholders or users because tests in the form of plain text.
  • Users and business Analysts can participate in test cases review process and give their feedback to enhancement.
  • Behaviour driven tests are easier to modify and hence.
  • Business Driven Testing tools are open source which reduces the source of investment.
  • Very easy to maintain.
  • We can implement in mobile testing.

BDT with Cucumber Framework Implementation:

If we get the business requirement or user story from the user, the user story requires to define every piece of requirement in terms of:

  • who is the primary stakeholder for a particular requirement?
  • what effect does the user wants from this requirement?
  • what business value would the user get if the aforesaid requirement is achieved.

Consider the below example to understand the above.

As a user of the Gmail, I want to find a Gmail link in Google Search Page, So that I can see the Gmail login page.

We have to write the above behaviour in feature file format (-Given -When -Then format).

  • Given describes the pre-requisites for the expectation
  • When describes the actual steps to carry on the effect of the expectation
  • Then describes the verification that the expectations were met.

Feature File: Test.feature

test-scenario-test-case

Feature can contain multiple scenarios and scenarios can contain steps.

We have to follow the steps to execute and run steps with cucumber:

  1. Create a project directory: In that create 3 folders one for feature files, one for java libraries and one for step definition file as below.project-directory

     

  2. Copy the Test.feature file in features folder. Test.featuretest-feature
  3. Get the following cucumber jar files and copy into jars foldercucumber
  4. Now we have to compile the feature file from command line for step definition methods generation. Open command prompt and go to the project directory and give the command as: Java –cp “jars/*” cucumber.api.cli.Main –p pretty featurescucumber-1
  5. Press enter then we will get the step definition methods as follows:cucumber-2

    Copy the selected three methods and paste into StepDefinition.java file.

    Prior to that just create StepDefinition.java file as

    package step_definition; // we have to give the folder name as package

    import cucumber.api.java.en.Given;

    import cucumber.api.java.en.Then;

    import cucumber.api.java.en.When;

    import cucumber.api.PendingException;

    public class StepDefinition {

    // We need copy the methods generated from the commandline.

    }

    Note: Remove the throw new PendingException(); line because we are not dealing with that.

  6. Compile the StepDefinition.java file and enter the following command from the command line then the .class file will be generated in the step_definition

               javac -cp "jars/*" step_definition/StepDefinition.java

  7. Enter the below commands and run the file for getting result.

                java -cp "jars/*;." cucumber.api.cli.Main -p pretty -g step_definition features/Test.feature

    cucumber-3

    If we want the result in json format then we have to give the command as

    java -cp "jars/*;." cucumber.api.cli.Main --plugin json -g step_definition features/Test.feature

    Note: We can see the result in so many ways for that refer with the help of

    java -cp "jars/*;." cucumber.api.cli.Main–help

    At Qentelli, we have applied these principles in complex N-Tier architecture based applications to bring Continuous Delivery to our customers. The next steps in the sequence are ensuring Continuous Testing covers Continuous Security and Performance Engineering followed by Continuous Build, Deployments and Monitoring and Feedback. To learn more about Quality Driven Development, Continuous Delivery the Qentelli Way and DevOps reach out to us.

 

Authors