Forum Discussion

funmay's avatar
funmay
Contributor
6 years ago

How to call a step in Step definition in TestComplete

How can i call step into another scenario for the Step definition.I know how to do this in Specflow but i do not how the to call the step in other to avoid duplication.Could you please give me exampl...
  • AlexKaras's avatar
    AlexKaras
    6 years ago

    Hi,

     

    What about this:

     

    [Binding]
    public class MySteps: Steps
    {

    Given("I want to create a sales order") ------------Senario 1 - step definition

    public void CreateSalesOrder()
    {

      __CreateSalesOrder();

    }

    Given("I open the sales order page") ------------Senario 1 - step definition

    public void SalesOrderOpened()
    {

      __SalesOrderOpened();

    }

    Given("I click the add new order button") ------------Senario 1 - step definition

    public void ClickNewButton()
    {

      __ClickNewButton();

    }

    Then("a new sales order is created") ------------Senario 1 - step definition

    public void OrderCreated()
    {

      __OrderCreated();

    }

     

    public void __CreateOrder()
    {

      __CreateSalesOrder();

      __SalesOrderOpened();

      __ClickNewButton();

      __OrderCreated();

    }

     

    ------For scenario 2's first step which would be calling scenario 1 step definitions

    [Given("I have created an order")]
    public void CreateOrder()
    {

      __CreateOrder();