Capturing App Launch Metrics On Android
While Appium is most much used for functional testing (do the functionality of my app behave?), it can also be used to drive other kinds of testing. Performance is a big and important area of centering for testers, and one key performance metric is app launch time. From a exploiter & # x27; s view, how long does it take from the time they tap the app picture to the clip they can interact with it? App launch clip can be a big component of user frustration. I cognise for myself that if an app takes too long to load, I often switch to something else and don & # x27; t even bother expend it unless I absolutely hold to. So, how can we check this? The main trick is to use one little-known capability: Setting autoLaunchto false Tell the Appium server to start an mechanization session, butnotto establish your app. This is because we want to launch the app in a controlled and time-able fashion later on. It & # x27; s also important to remember that because Appium won & # x27; t be launching the app for us, we & # x27; re responsible for ensuring all app permission have been granted, the app is in the right reset province (ground on whether we are time first launching or subsequent launching), etc ... Once we have a session started, but no app launched, we can use thestartActivitycommand to direct our app to found, without any of the extra steps that Appium often takes during launching, so we get a relatively arrant measure of app launch. We might also care about not simply how long the app takes to launch, but how long until an element is available, so we can throw in a wait-for-element: SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses. But this is precisely making the app launch; how do we actually measure the time it took? One technique would be to simply create timestamps in our customer code before and after this logic, and get the difference between them. However, this would also count the time taken by the asking to and reply from the Appium host, which could add up to a lot depending on the network latency in between the client and server. Ideally, we & # x27; d look for a number on theserveritself, and gratefully this is something we can do thanks to Appium & # x27; sEvents API. Using the Events API, we can determine when exactly the startActivity command commence and end on the server. We can too find the conflict between the end of the findElement command and the start of the startActivity command, which gives us a (not quite as accurate) measure of the time to interactivity of the app. (The reason it & # x27; s not as accurate is that we do potentially have some clip lose due to latency of the findElement command itself, which we could act around utiliseExecute Driver Script). Here & # x27; s how we use the Events API to accomplish this: Essentially, we get the event from the server, and pull out the CommandEvents for the commands we care about. Then we are gratuitous to compare their timestamps as necessary. Looking at app launching on emulators or the device you have on hand topically is all good and good, but it & # x27; s too important to get a good idea of the metric across many different devices, as well as over time across flesh. The basic proficiency we used above of simply printing the metric to the screen is obviously not a scalable way to tag performance. In a existent test environment, you & # x27; d want to log that metrical to a database of some kind, for example CloudWatch, DataDog, Splunk, etc ... Then you & # x27; d be able to see it in a decent dashboard and set alerts for performance degradations with new builds. But let & # x27; s talk a little bit about running on multiple devices. Since I don & # x27; t have access to a bunch of devices, I put together an illustration of how to run this app launch time test onAWS Device Farm. The way Device Farm works is that you set up a test & quot; run & quot;, upload your app as easily as a zipfile of your test project. To facilitate building the zipfile of my Java exam with all its dependencies, I added these handy hand to mybuild.gradle file: With these scripts, whenever I ask to generate a bundle for Device Farm, I can but run ./gradlew zip (after making sure the old file are deleted). The lonesome change I had to make to my test code itself was to do sure to get the itinerary to my uploaded app via an environment variable set by DeviceFarm: When you create a test run on AWS, you walk through a sorcerer that asks you for a bunch of info, including the app and test bundle. At some point, you & # x27; ll also have the opportunity to tweak the test configuration, which is in YAML format: For this example, I needed bleeding-edge Appium features that are only usable in a beta version, so I put together acustoms Device Farm configthat I pasted into the config section and saved for reuse. Note that I wouldn & # x27; t recommend doing this on your own, but instead use the default config and one of the tested and supported versions of Appium. Once I & # x27; ve got the run all ready to go, I can choose which devices I want to run on. For this article, I chose to run on 5 devices: model is pretty different from other services I & # x27; ve used before. Rather than running the Appium client topically and talking to a outside server, the test bundle is uploaded to AWS via this wizard, and then the tests are scheduled and executed completely remotely. So at this point I sat back and waited until the exam were complete. When they were, I was able to see the consequence for all device (they passed -- eventually, anyways!) Since I just printed the launch clip metrics to stdout, I had to dig through the examination output to find them. When I did, these were the results: DeviceTime to launchTime to interactivityGoogle Pixel2.554s3.263sGoogle Pixel 22.064s2.291sSamsung Galaxy S6 (T-Mobile) 2.392s5.201sSamsung Galaxy S6 (Verizon) 2.392s4.468sSamsung Galaxy S9+2.404s2.647s That & # x27; s it! I definitely encourage all of you to get tracking app launch time in your builds, as even a few second can create a big difference in user satisfaction. Want to control out the full source codification for this clause & # x27; s test? As e'er, you canfind it on GitHub. Lead, Content Marketing, HeadSpin Inc. Piali is a active and results-driven Content Marketing Specialist with 8+ years of experience in crafting engaging narration and marketing collateral across diverse industries. She excels in collaborating with cross-functional teams to germinate innovative content scheme and deliver compelling, authentic, and impactful content that resonates with quarry hearing and enhances brand legitimacy. 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)



Capturing App Launch Metrics On Android
AI-Powered Key Takeaways
Using Appium To Capture Launch Time
capabilities.setCapability (`` autoLaunch '', false);Activity act = new Activity (APP_PKG, APP_ACT); act.setAppWaitActivity (APP_WAIT); driver.startActivity (act);wait.until (ExpectedConditions.presenceOfElementLocated (loginScreen));ServerEvents evts = driver.getEvents (); ListComparing Performance Across Devices
// for getting jar for aws // rootage: https: //stackoverflow.com/a/52398377 task marshallClasspathDeps (type: Copy) {from sourceSets.test.runtimeClasspath // if you need this from the dependencies in the build.gradle then it should be: // from sourceSets.main.runtimeClasspath include ' * * / * .class' include ' * * / * .jar' exclude {FileTreeElement details - > details.file.name.contains ('Edition ') || details.file.name.contains ('kotlin ')} into 'build/libs/dependency-jars'} //packaging tests task which is generated from sample using gradle init task packageTests (type: Jar) {from (sourceSets.test.output) {include ' * * / * DeviceFarm * '} classifier = 'tests' includeEmptyDirs = mistaken} // create zip archive // origin: https: //stackoverflow.com/a/36883221/8016330 task zip (type: Zip) {dependsOn packageTests, marshallClasspathDeps from 'build/libs/' include ' * ' include ' * / * ' //to include contents of a folder present inside dependency-jars directory archiveName 'zip-with-dependencies.zip'}String app = System.getenv (`` DEVICEFARM_APP_PATH '');


Piali Mazumdar
Capturing App Launch Metrics On Android
4 Parts
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for advanced user (Part 3)
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for advanced user (Part 4)
Discover how HeadSpin can empower your job with superior testing 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)












