Refactoring -1
Note
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 thesteps
package - In the
StartingSteps
class, create two empty methods, calledstartAppiumServer
andstopAppiumServer
:
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 hooks can be used and defined in a class file in the steps folder. However, cucumber doesn't mandate the location...