Prerequisites
Please complete Part 3 of this tutorial before continuing.
Implementing step definitions
Once project structure is implemented, before running the tests step definitions for each scenario step must be implemented.
1) Navigate to GoogleSearch.feature file and go to Given I've launched Chrome browser step definition.
In this step browser should be launched based on user input. Change the step definition as shown. word chrome is parameterised in step definition and passed to launchBrowser method in SeleniumHelper.cs class.
2) Implement the rest of the step definitions as given below. Leave Then I can see search results step definition as pending for the time being.
3) Please comment the Then I can see search results step in GoogleSearch.feature file as currently it is not required.
3) Please comment the Then I can see search results step in GoogleSearch.feature file as currently it is not required.
Running tests using Test Explorer in Visual Studio
1) Once everything is completed, build the project by selecting Build > Build Solution.
If there aren't any errors, build will be successful.
2) Remove the UnitTest1.cs class from the project as it is not required.
3) In order to run the test in Visual Studio, navigate to Test Explorer. (If Test Explorer is not available, View > Test Explorer will show the Test Explorer window)
Test Explorer will show the available tests. To run the test, right-click on the test and select Run.
If everything goes well, chrome browser will open and test will be executed. Once test is completed, then browser will be closed.
3) In order to run the test in Visual Studio, navigate to Test Explorer. (If Test Explorer is not available, View > Test Explorer will show the Test Explorer window)
Test Explorer will show the available tests. To run the test, right-click on the test and select Run.
If everything goes well, chrome browser will open and test will be executed. Once test is completed, then browser will be closed.