Agile Requirements Designer

How to handle  duplicate block codes while exporting merged scripts

  • 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