Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[plugin-mobile-app] Add steps to record performance data on iOS devices #1988

Merged
merged 5 commits into from
Jan 12, 2022

Conversation

dtargons
Copy link
Contributor

@dtargons dtargons commented Sep 21, 2021

Closes #1789

@codecov
Copy link

codecov bot commented Sep 21, 2021

Codecov Report

Merging #1988 (07def96) into master (a0e448d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1988   +/-   ##
=========================================
  Coverage     96.34%   96.34%           
- Complexity     5396     5400    +4     
=========================================
  Files           764      765    +1     
  Lines         15483    15499   +16     
  Branches       1032     1032           
=========================================
+ Hits          14917    14933   +16     
  Misses          442      442           
  Partials        124      124           
Impacted Files Coverage Δ
...vidus/bdd/mobileapp/steps/IOSPerformanceSteps.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0e448d...07def96. Read the comment docs.

args.put(PROFILE_NAME, instrument);

File traceZip = new File(path);
String b64Zip = (String) getWebDriver().executeScript("mobile: stopPerfRecord", args);
Copy link
Member

@uarlouski uarlouski Sep 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if I forget to stop recording by the end of scenario? can it lead to resource leaks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data is recorder by appium. I haven't seen any information about possibility of memory leaks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My question was about consequences if we don't stop performance recording, is the recording just aborted if we close the session?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, recording will be aborted on Appium session close.


File traceZip = new File(path);
String b64Zip = (String) getWebDriver().executeScript("mobile: stopPerfRecord", args);
byte[] bytesZip = Base64.getMimeDecoder().decode(b64Zip);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need mime decoder here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I don't familiar with encode/decode functionality. I just reused official appium's approach to work with such data.

* @param path Path to the location for saving the screenshot
* @throws IOException If an input or output exception occurred
*/
@When("I stop recording '$instrument' metrics and save data to '$path'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's unclear how these results could be helpful, should we import them into instruments manually?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is possible to parse the results and push some HTML attachment into allure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Result is *.trace file. It could be opened by Xcode Instrument application to see data in visual format. Also it is possible to parse this data into xml format using xcrun xctrace Xcode's utility

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I correct that in your case you're parsing perf results with xctrace and validating XML? If that so. could you please submit a short user guide on that here:
https://github.com/vividus-framework/vividus/tree/master/docs/modules/guides

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't actually measure performance of application now, but use this functional only for collecting custom development metrics which where added into code. I don't think it will be useful. I added link to documentation for xctrace utility with examples of usage

{
if (!webDriverManager.isIOS())
{
throw new IllegalStateException("Step is only supported on IOS devices");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it applicable for iOS real devices only? or simulators are in scope as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simulators are in scope

dtargons and others added 2 commits October 7, 2021 15:53
Co-authored-by: Valery Yatsynovich <valfirst@yandex.ru>
When I stop recording `$instrument` metrics and save results to file `$path`
----

. `$instrument` - The instrument of Xcode Instruments utility
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it was already mentioned in the previous comments, but not fixed yet: please enumerate the available instruments or provide the link how to find the list

When I stop recording `$instrument` metrics and save results to file `$path`
----

. `$instrument` - The instrument of Xcode Instruments utility
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. `$instrument` - The instrument of Xcode Instruments utility
. `$instrument` - The instrument of Xcode Instruments utility.

----

. `$instrument` - The instrument of Xcode Instruments utility
. `$path` - Path to save archive with collected data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. `$path` - Path to save archive with collected data
. `$path` - The path to the file to save an archive with collected data.


private void checkIOS()
{
Validate.isTrue(webDriverManager.isIOS());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please put some message here so that users can understand the error

@ikalinin1 ikalinin1 self-requested a review November 8, 2021 08:37
@valfirst valfirst merged commit 7908a18 into vividus-framework:master Jan 12, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add steps to capture/validate performance metrics for native iOS Apps
4 participants