What is “Specification by Example”?Knowledge in 3 minutes

What is “Specification by Example”?

Specification by Example (SBE) is a method of describing software requirements in the form of test cases, which can prevent gaps in understanding between developers and testers by describing requirements as concrete examples. SBE can also be used as a basis for automating test cases.

A test case described in SBE typically consists of the following three elements

  • Input data
  • Expected output data
  • Test execution conditions

Input data is the data that is passed to the software. Expected output data is the data that the software outputs in response to the input data. Test execution conditions are the conditions that must be met when executing a test case.

Sample written in Cucumber

Cucumber is a framework for automating test cases; with Cucumber, test cases can be written in natural language. This facilitates test case creation and maintenance.

Sample code

Feature: login

  Scenario: Login successfully
    Given I have users:
      | id        | password |
      | fuge   | hoge         |
    When I type 'fuge' in 'id'
    And I type 'hoge' in 'password'
    And I I click on 'enter'
    Then I should see 'Login successfully'

This code is a test case for the login screen written in Cucumber: Feature represents a group of test cases;

Scenario represents a test case;

Given represents the starting condition of the test case;

When represents the execution of the test case; and Then represents the expected result of the test case.

When is SBE used?

SBE is often used in agile software development. In agile software development, software development is repeated in short cycles, so test cases written in SBE can be created in parallel with software development. This improves the quality of the software.

Test-Hack

Recent Posts

“Seven Basic Tools of Quality Control” for Web App tester

"Seven Basic Tools of Quality Control" Difference between “New” and “Old" "Seven Basic Tools of…

4 months ago

How to Postman environment variable settings. Knowledge in 3 minutes

This article uses Postman for Mac , Version 10.0.32 In Postman, it is useful to…

7 months ago

What is Edge AI? Knowledge in 3 minute

First, what is Edge Computing? Before understanding Edge AI, it is helpful to first understand…

7 months ago

What does usability testing do? Knowledge in 3 minute

Usability Testing is described in the ISQB Glossary as follows Usability TestingTesting to evaluate the…

7 months ago

What is “Shift-left” ? Knowledge in 3 minutes

Do you understand what the term "shift-left" means?In this article, we will explain "What is…

7 months ago

What is “Inception deck” ? Knowledge in 3 minutes

What is "Inception deck" ? Inception Deck is one of the practices of Agile development…

7 months ago