Agile Requirements Designer

Expand all | Collapse all

How to handle  duplicate block codes while exporting merged scripts

Jump to Best Answer
  • 1.  How to handle  duplicate block codes while exporting merged scripts

    Posted 05-23-2019 03:23 PM

    Hi,

     

    I am using ARD to generate feature file and step definition file for my cucumber test.

    I have 3 blocks in my flow: Login, Add/Deduct, Logout

    In case there is a multi-output box in my flow, which routes to two different blocks(AddBalance and DeductBalance), my merged script Feature file looks like:

     

    Scenario: TestPath1

    Given Login

    When AddBalance

    Then Logout

    Scenario: Testpath2

    Given Login

    When DeductBalance

    Then Logout

    But the issue is with the merged script Step definition file:

     

    @Given("^Login$") public void Login(){   //code  }

    @When("^AddBalance$")  public void AddBalance(){   //code  }

    @Given("^Logout$") public void Logout(){   //code  }

     

    @Given("^Login$") public void Login(){   //code  }

    @When("^DeductBalance$") public void DeductBalance(){   //code  }

    @Given("^Logout$") public void Logout(){   //code  }

    What i want is, to get all the methods only once (since method will be called from feature file), like shown below:

     

    @Given("^Login$") public void Login(){   //code  }

    @When("^AddBalance$")  public void AddBalance(){   //code  }

     

    @When("^DeductBalance$") public void DeductBalance(){   //code  }

    @Given("^Logout$") public void Logout(){   //code  }

    Can anyone suggest a way to get rid of duplicate methods in the merged script which exporting the step definition file?

     

    Thanks



  • 2.  RE: How to handle  duplicate block codes while exporting merged scripts
    Best Answer

    Posted 07-04-2019 08:39 AM
    Hey Lisa,

    Using Agile Requirements Designer to create Gherkin files is a really good way of creating high quality automation.
    As Agile Requirements Designer is more designed to generate the actual tests, it should output your feature files containing your scenarios.
    The step definitions should be placed into your Agile Requirements Designer automation configuration file.
    I would suggest not creating your step definition file within ARD but rather created and maintained independently.

    Something which you may find helpful, we are running a webinar which will cover some of the functionality around producing automation scripts.
    If you find this interesting, you can register with the following link.

    https://www.brighttalk.com/webcast/9305/360182?utm_source=CA+Technologies&utm_medium=brighttalk&utm_campaign=360182


    Hopefully this helps.
    Josh