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

Refactor -1


Let's recall the HomePageSteps class and the iLaunchQuikrApp() method:

@When("^I launch Quikr app$")
 public void iLaunchQuikrApp() throws Throwable {
     DesiredCapabilities capabilities = new DesiredCapabilities();
     capabilities.setCapability("platformName", "Android");
     capabilities.setCapability("platformVersion", "5.1");
     capabilities.setCapability("deviceName", "Nexus");
     capabilities.setCapability("noReset", false);
     capabilities.setCapability("fullReset", true);
     capabilities.setCapability("app", "/Users/nishant/Development/HelloAppium/app/quikr.apk");

     appiumDriver = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
     appiumDriver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
 }

Now, the instance of appiumDriver can be used by other step classes and not only this one. So, to solve this, we will declare a BaseSteps class, which creates the AppiumDriver instance to be used throughout the test session.

Follow...

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}