简体   繁体   中英

Getting App Performance Data from Appium in iOS

Im curious if there is any way to get app performance data during an appium iOS test? I understand that if I were using appium testing an android app, I would be able to get app performance. Appium does not support the iOS version of this. I've tried running my tests with an xctrace recording, which works, but not well at all.

The ultimate goal for me is to get my apps memory performance, cpu usage, and other general statistics while running a routine smoke test. Has anyone been able to find a reliable appium > iOS performance recording method?

There are several options you can go with. All up to the point where you have automated frameworks including time-series tools for trend analysis.

Disclaimer: I have no experience with profiling and XCode - my understandig is that this is more towards unit-testing rather than UI-testing/user experience level

Option 1: Simple logging You can start off by logging information for each step you are executing. Create a logfile for every execution of your test. Use test step names, record timers for test steps and extract Appium (only for Android) CPU/RAM/Network information for each test step.

iOS performance data: I found two options you can use to retrieve CPU data:

  • Create a recording in Appium with Instruments from Apple by using mobile: startPerfRecord and mobile: stopPerfRecord . This is a seperate recording file which you can analyze.

  • Use the py-ios-device Python library to retrieve iOS metrics from the connected device. If you script the commands and read the output you may capture specific CPU/RAM data from specific time points and create logging.

This is good practice to start off with, because you are creating a blueprint for data analysis possibilities.

2022-11-09 12:02:32.318 +01:00 [INF] : Stepname: (1) Start app, Timer: 1200ms, CPU: 21%, RAM: 88%, etc....
2022-11-09 12:02:32.318 +01:00 [INF] : Stepname: (2) Login, Timer: 3100ms, CPU: 64%, RAM: 77%, etc...

Though you need to develop this additionally in your script in order to log all this information.

Option 2: Time-series & event tools Once you are able to capture performance data of each test step/event you have in Appium, there are possiblities to insert this data into time-series tools for neat dashboarding and analysis. Tools like Splunk or Log Analytics are able to query events you insert for every step including all metadata.

These tools generally work with JSON events. There are a lot of easy ways to convert log information into JSON - depending on your coding skills.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM