Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mobile Test Automation with Appium

You're reading from  Mobile Test Automation with Appium

Product type Book
Published in Jun 2017
Publisher Packt
ISBN-13 9781787280168
Pages 256 pages
Edition 1st Edition
Languages
Author (1):
Nishant Verma Nishant Verma
Profile icon Nishant Verma

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 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 hooks can be used and defined in a class file in the steps folder. However, cucumber doesn't mandate the location...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}