ExecuteAutomation

Calling steps from step definition

There are situations where we might need to call a step or steps from within a step definition, so that Hence the scenarios will look something like this, the second scenario step definition as you can see has a step (Given I login and enter user details) performs all the operation of scenario one by calling steps within step definition

Here is the complete video of the above discussion Here is the complete code of the above video
        [Given(@"I login and enter user details")]
        public void GivenILoginAndEnterUserDetails()
        {
            //Create a column header
            string[] colHeader = { "UserName", "Password" };
            string[] row = { "admin", "admin" };
            //Created a table with values
            var table = new Table(colHeader);
            table.AddRow(row);

            Given("I login to application", table);

            string[] colHeaderForUF = { "Title", "FirstName", "Initial" };
            string[] rowForUF = { "Mr.", "Karthik", "KK" };
            table = new Table(colHeaderForUF);
            table.AddRow(rowForUF);

            Given("I enter following details", table);
        }
Thanks for reading the post and watching the video!!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK