Speeding Up Tests With Deep Links
One of the biggest trouble imply in is that functional tests can beslow. Some functional examination frameworks are fast than others, and I & # x27; ll be the first to admit that Appium isn & # x27; t ever as quick as I would care. Speed itself is a topic for another clip! This edition is all about how to make automation speed less important overall, by progress crosscut into your examination. What do I signify by shortcuts? Let & # x27; s conduct logging in to an app as an representative. Most apps require some kind of login step. Before your tests can access all the functionality they & # x27; re supposed to work, they must first log in. And if you are keeping your tests atomic, as you should,everytest has to log in separately. This is a huge wastefulness of time. You only need to run Appium bid on your login screen when you are actively testing the login functionality. For every other test, it & # x27; d be great to just bring someplace behind the authentication barrier and get directly to business. SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses. We can reach this on iOS and Android with something telephone a deep link. Deep tie are especial URLs that can be associated with specific apps. The developer of the app registers a unique URL scheme with the OS, and from so on, the app will come alive and will be capable to do whatever it want based on the substance of the URL. What we need, so, is some form of peculiar URL that our app interprets as a login attempt. When it find that it has be activated with that URL, it will perform the login behind the scene and airt the app to the right logged-in view. I recently spent some clip adding deep link interpretation intoThe App. Exactly how I did that is beyond the scope of this edition and is specific to React Native apps in any case. There are plenty of tutorials online for bestow deep tie support to your iOS or Android app. But what I ended up with inv1.2.1is support for a deep nexus that looks like this: In other words, with The App installed on a device, we can direct the twist to navigate to a URL with that sort, and The App will wake up and perform authentication of the request username/password combination behind the scenes, underprice the user to the logged-in area instantly. Outstanding! Now how do we do the like thing with Appium? It & # x27; s leisurely: precisely usedriver.get. Since the Appium guest libraries only broaden the Selenium one, we can use the same command that Selenium would use to pilot to a browser URL. In our case, the conception of URL is just ... bigger. So let & # x27; s say we need to log in with the usernamedarlene and the countersigntesting123. All we have to do is manufacture a test that opens a session with our App Under Test, and runs the next command: Of class, it & # x27; s up to the app developer to build the ability to respond to URLs and perform the appropriate action with them. And you belike want to make sure that URLs used for testing are not turn on in production versions of your app! But it & # x27; s worth building them into your app for prove, or convert your developer to. Being able to set up arbitrary test state is the best way to cut off significant portions of time off your testing. In my own experimentation with The App, I noticed a savings of 5-10s on each test only by bypassing the login screen in this way. These savings add up! Here is a entire example. It evidence two ways of testing that the logged-in experience work correctly: initiatory by navigating the login UI with Appium, and then by using the deep linking trick described in this edition. It also prove an example of what an extremely simple inline Page Object Model might look same, as a way to reuse code as much as possible. You & # x27; ll also notice that because my app is cross-platform, I & # x27; m able to run these tests on both iOS and Android with minimal code difference. Lead, Content Marketing, HeadSpin Inc. Piali is a dynamic and results-driven Content Marketing Specialist with 8+ years of experience in craft engaging narratives and marketing collateral across diverse industries. She excels in collaborate with cross-functional teams to germinate innovative content strategies and deliver compelling, authentic, and impactful content that resonates with target audiences and enhances marque genuineness. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts..png)



Speeding Up Tests With Deep Links
AI-Powered Key Takeaways
Check out:
theapp: //login/ & lt; username & gt; / & lt; password & gt;Also read:
driver.get (`` theapp: //login/darlene/testing123 '');importation io.appium.java_client.AppiumDriver; importee io.appium.java_client.MobileBy; meaning io.appium.java_client.android.AndroidDriver; import io.appium.java_client.ios.IOSDriver; significance java.io.IOException; import java.net.URL; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; meaning org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; @ RunWith (JUnit4.class) public class Edition007_Deep_Linking {private String APP_IOS = `` https: //github.com/cloudgrey-io/the-app/releases/download/v1.2.1/TheApp-v1.2.1.app.zip ''; private String APP_ANDROID = `` https: //github.com/cloudgrey-io/the-app/releases/download/v1.2.1/TheApp-v1.2.1.apk ''; private String AUTH_USER = `` alice ''; private String AUTH_PASS = `` mypassword ''; @ Test public void testLoginSlowIOS () throws IOException {IOSModel model = new IOSModel (); IOSDriver driver = new IOSDriver < > (new URL (`` http: //localhost:4723/wd/hub ''), model.caps); runStepByStepTest (driver, model);} @ Test public void testLoginSlowAndroid () shed IOException {AndroidModel model = new AndroidModel (); AndroidDriver driver = new AndroidDriver (new URL (`` http: //localhost:4723/wd/hub ''), model.caps); runStepByStepTest (driver, model);} individual void runStepByStepTest (AppiumDriver driver, Model framework) {WebDriverWait wait = new WebDriverWait (driver, 10); try {wait.until (ExpectedConditions.presenceOfElementLocated (model.loginScreen)) .click (); wait.until (ExpectedConditions.presenceOfElementLocated (model.username)) .sendKeys (AUTH_USER); wait.until (ExpectedConditions.presenceOfElementLocated (model.password)) .sendKeys (AUTH_PASS); wait.until (ExpectedConditions.presenceOfElementLocated (model.loginBtn)) .click (); wait.until (ExpectedConditions.presenceOfElementLocated (model.getLoggedInBy (AUTH_USER)));} finally {driver.quit ();}} @ Test public emptiness testDeepLinkForDirectNavIOS () throws IOException {IOSModel model = new IOSModel (); IOSDriver driver = new IOSDriver < > (new URL (`` http: //localhost:4723/wd/hub ''), model.caps); runDeepLinkTest (driver, model);} @ Test public void testDeepLinkForDirectNavAndroid () shed IOException {AndroidModel model = new AndroidModel (); AndroidDriver driver = new AndroidDriver (new URL (`` http: //localhost:4723/wd/hub ''), model.caps); runDeepLinkTest (driver, poser);} individual null runDeepLinkTest (AppiumDriver driver, Model framework) {WebDriverWait expect = new WebDriverWait (driver, 10); try {driver.get (`` theapp: //login/ '' + AUTH_USER + `` / '' + AUTH_PASS); wait.until (ExpectedConditions.presenceOfElementLocated (model.getLoggedInBy (AUTH_USER)));} finally {driver.quit ();}} private abstractionist class Model {public By loginScreen = MobileBy.AccessibilityId (`` Login Screen ''); public By loginBtn = MobileBy.AccessibilityId (`` loginBtn ''); public By username; public By password; public DesiredCapabilities caps; abstract By getLoggedInBy (String username);} individual family IOSModel extends Model {IOSModel () {username = By.xpath (`` //XCUIElementTypeTextField [@ name=\ '' username\ ''] ''); password = By.xpath (`` //XCUIElementTypeSecureTextField [@ name=\ '' password\ ''] ''); caps = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` iOS ''); caps.setCapability (`` deviceName '', `` iPhone 7 ''); caps.setCapability (`` platformVersion '', `` 11.2 ''); caps.setCapability (`` app '', APP_IOS);} public By getLoggedInBy (String username) {return MobileBy.AccessibilityId (`` You are logged in as `` + username);}} private class AndroidModel cover Model {AndroidModel () {username = MobileBy.AccessibilityId (`` username ''); password = MobileBy.AccessibilityId (`` password ''); detonator = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` Android ''); caps.setCapability (`` deviceName '', `` Android Emulator ''); caps.setCapability (`` app '', APP_ANDROID); caps.setCapability (`` automationName '', `` UiAutomator2 '');} public By getLoggedInBy (String username) {return By.xpath (`` //android.widget.TextView [@ text=\ '' You are logged in as `` + username + `` \ ''] '');}}}Piali Mazumdar
Speeding Up Tests With Deep Links
4 Parts
-1280X720-Final-2.jpg)
Regression Intelligence practical usher for modern users (Part 3)
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for advanced users (Part 4)
Discover how HeadSpin can empower your business with superior prove capabilities







Discover how HeadSpin can empower your business with superior testing capabilities
Discover how HeadSpin can empower your business with superior testing capabilities
Connet Now


Automate This With SUSA
Test Your App Autonomously







.png)












