Forum Discussion

loridee's avatar
loridee
New Contributor
6 years ago

BDD Step Reuse

Hi,   Anyone have any ideas or suggestions for reusing 2 BDD steps that differ only in their keyword?    Given I log in as John Smith When I log in as John Smith   Would really love thi...
  • AlexKaras's avatar
    6 years ago

    Hi,

     

    Hm-m-m...

    Is there anything that prevents this:

    Given ("I log in as John Smith", function () {

         login();

    });

     

    When ("I log in as John Smith", function () {

         login();

    });

     

    function login() {

      // ...

    };

     

    ?