Note: We will take one of the feature files or code bases (Android in this case) to demonstrate some of the concepts while refactoring. This can also be followed with the other iOS code written.
In this first refactoring, we will remove the manual dependency of starting and stopping the Appium server, and we will do it programmatically:
- Create a new class called StartingSteps under the steps package
- In the StartingSteps class, create two empty methods, called startAppiumServer and stopAppiumServer:
public void startAppiumServer(){
//code to start appium server
}
public void stopAppiumServer(){
// Code to stop appium server
}
At this point in time, we need to know the concept of hooks in cucumber. So basically, cucumber gives you a number of hooks, which allow one to run certain code at a certain point in the test life cycle. These...