I have written some performance test cases using XCTest framework in my project. I was wondering is it possible to set baseline value for performance testing programmatically before the first run or is there any other way to set the baseline except from the performance result window.
I've unfortunately not found a way to set the baseline programmatically. But there are some other options for setting it.
After you have set the baseline once through Xcode you can then access the info.plist where the baseline is stored and update it that way.
To get to the stored baseline data right click on your .xcodeproj file and select "Show package contents" then go into the "xcshareddata" folder and the "xcbaselines" folder will have the data. I've verified that after updating the relevant info.plist the change is reflected in future test runs.
Alternatively, to avoid initially setting the baseline in Xcode you might try (as the article linked below suggests) to generate the baseline info.plist with a script, but I have not given that a try myself.
More info in this great article https://developer.squareup.com/blog/measureblock-how-does-performance-testing-work-in-ios/ in the "Where is the baseline stored?" and "Can I generate plists with a script?" sections.
Hope this info helps someone else out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With