Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
195 views
by Contributing Tester (26 points)
retagged by
I have been writing test in BDD in a python project and using pytest-bdd. below is my feature code

Feature: User login
    As registered a user
    I will be to be able to login to the site with my email
    And will also be able to login with linkedIn profile

    Scenario: Visit login page and click user login

        Given I am a registered user

        When I click on login link I can login with email and password
            And I can insert my email
            And I can insert my password

        Then I will be redirected to system after authentication

        When I click forget password menu
        Then I will be redirected to password reset page
        And I after giving email I will get a password reset email

        When I click the login with linkedin button
        Then I will redirected to linkedin and authenticated with linkedin
        And I can login to the site by authenticated via linekdIn

Can you suggest anyway I can make it better? how do you write your BDD features?

1 Answer

0 like 0 dislike
by
selected by
 
Best answer

In case of my BDD feature, I will try avoid unnecessary validations. I can rewrite it cut short is as given below.

Scenario: Verify user login
    Given I am a registred user
    And I am on a login page
    When I enter username and password
    And I click login button
    Then I should be redirected to the system
    
Scenario: Forget password validation
    Given I am on a login page
    When I click on forget password menu
    And I should be redirected to the password reset page
    The I enter email address
    And I click submit button
    Then I should receive password reset email.

Scenario: Verify login with LinkedIn button
    Given I am on login page
    When I click on login with LinkedIn button
    Then I am authenticated with LinkedIn
    And I should be redirected to the system

I am reusing most of the given, when and then. Also, try to divide your tests into small small scenarios.

Hope that helps!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...