Is there a way to run a trace on an XCUIApp functional/integration test automatically?

I'd love to be able to run the HTTP traces on a few specific integration-style tests that I have written using XCUITesting. Is there a way, even with external scripting, to invoke the test and have the profiler capture a trace like this?

Accepted Reply

Is there a way, even with external scripting, to invoke the test and have the profiler capture a trace like this?

You can invoke the instruments Network Trace tool to record all HTTP traffic or just specific HTTP traffic for a process through a command line interface. You'll want to take a look at:


# Recording a trace for a specific target
% xctrace record --attach [pid for testing target]

# Getting information on the options available to record a trace:
% xctrace record -h

This should allow you to get started if invoking a trace from an external testing script.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Replies

Is there a way, even with external scripting, to invoke the test and have the profiler capture a trace like this?

You can invoke the instruments Network Trace tool to record all HTTP traffic or just specific HTTP traffic for a process through a command line interface. You'll want to take a look at:


# Recording a trace for a specific target
% xctrace record --attach [pid for testing target]

# Getting information on the options available to record a trace:
% xctrace record -h

This should allow you to get started if invoking a trace from an external testing script.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com