How to write features and scenarios in BDD

I am currently working on a subscriber model where it should be compliant with GDPR regulations. However it is indeed a part of the entire picture, but I would like to share my experience here.

First of all, Let us understand the Complexity of the problem statement.

As a client, I want out of box subscription plugin where I can quickly attach to any website and gather subscribers (any newsletter, RSS feed, blog etc.) from landing pages.

  1. It should validate the username and email address on the client side as well as server side.

  2. Upon request received it should send an email to confirmed user email and name

  3. when user press established link it should validate it and post a welcome message.

  4. Any subscriber should able to unsubscribe correctly.

  5. The system should be secure enough to handle email addresses and all links safely. Thus it should be prevented any unauthorised requests, and also data should be kept encrypted all the time.

So let us write some specifications by example

Here is my case for each kind of specification (scenarios required for such simple application)

This is a feature, and it may need more scenarios, but I think following are few of them which is enough for my requirements.

Bare in mind; I am not writing any codes or anything yet; I am just writing specifications by example so that I can build my application as BDD and TDD code first approach.

Feature: Generic Subscribers
    This is a new feature about
    New subscriber signed up

Scenario: New Subscriber requested
    Given I have entered Valid Name
    And I have entered Valid Email
    When I press, Subscribe
    Then dialogue box should show appropriate message

Scenario: Invalid Email Address
    Given I have entered a valid name
    And I have entered an Invalid email address
    When I press, Subscribe
    Then dialogue box should say an invalid email address

Scenario: Email Address Already Exists
    Given I have entered a valid name
    And I have entered already entered the email address
    When I press, Subscribe
    Then dialogue box should say check your emails.

Scenario: Name has too many Characters
    Given I have entered 100 characters in the name text box
    And I have entered the valid email address
    When I press, Subscribe
    Then dialogue box should say the name should be 50 characters long

Scenario: Upon valid new subscriber request trigger validate email
    Given I have received the valid new subscriber request
    And a request has valid Name and Email
    When I confirm a request
    Then I should send an email requesting to confirm email

Scenario: User clicked on confirm email link
    Given I have received confirmation email request
    And request has the valid token
    When  I validate token
    Then I mark user record as verified

Scenario: Subscriber Box validation
Given I have a subscriber box
And I have name box
And I have an email box
When I click subscribe
Then it should confirm the name
And the email as required.

Scenario: Request Validation with token
    Given I have a subscriber box with a valid token
    When I press, Subscribe
    Then it sends a token with a request header
    When I receive a request with a token in the header
    And I compare it with system
    Then I confirmed it is a valid request by reply.


So on…. it might need more cases where I can add later.

So design wise it looks so simple, but it is a complicated process to handle it correctly. Others may argue that why do you need Generic Subscriber box? Because it is cost effective if we have handle data securely than rely on 3rd Party Processors. Also, the confirmed email process will help to keep real subscribers and the actual user exists.

So if your system relies on the collecting such information or subscriber and you are struggling to get it done right then, you can contact me to design it correctly, or I am currently implementing the system where you can rent it as service for few bucks per month.  Please contact me for your inquiry, and  I will send you a complete demo which helps you to boost your brands.

[contact-form-7 id=”1147″ title=”Contact Me”]


Leave a Reply

Your email address will not be published. Required fields are marked *