I'm running some XCUITests that utilize the measure(metrics:block:) call to gather signpost metrics (using XCTOSSignpostMetric) from the app being tested.
Running the tests one at a time works just fine, but when I try to run multiple tests consecutively, all tests after the first fail with the error: "Cannot activate instrument while another is already active"
Is there something that I should be doing after the measure block is run or in a tearDown() to clean up the metrics being measured? I couldn't find any documentation about cleaning up metrics, but it appears that the underlying instruments are not being cleaned up appropriately when a test case completes.
Thanks in advance for any help you can offer.
Update: Here's an example of one of the errors we're seeing when we run multiple performance XCUITests consecutively:
*** Assertion failure in -[MXMOSSignpostMetric _constructProbe], /BuildRoot/Library/Caches/com.apple.xbs/Sources/MetricKit/MetricKit-60.60.1/MetricMeasurement/MetricMeasurement/metrics/MXMOSSignpostMetric.m:70
2020-04-02 10:51:51.779 PerformanceUITests-Runner[347:11285] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: _startDate'
Again, the failure is occuring when using measure(metrics:block:) to gather signpost metrics.
Any help would be greatly appreciated! Thanks!