Monday, January 20, 2020

Profiling Mac Unit Tests

Ilja A. Iwas:

Mac Devs: Is it just me, or is the “Profile ‘Test XYZ’” command in Xcode 11.3 broken? Instruments launches the main app, but does not run any tests. 🤷‍♂️

He’s filed bug FB7543911.

There was a brief period of time where running tests under Instruments worked for me, and it was glorious. Then the handy “Profile [test]” command stopped working—Instruments would launch but not record anything from the test. I reverted to the old method of setting a breakpoint and manually attaching Instruments to the test process while it was paused. Lately, that no longer works for me, either.

Mostly, I use Instruments to track down memory leaks. An alternative tool is the Memory Graph Debugger, which works within Xcode itself and never seems to have trouble attaching/recording.

2 Comments RSS · Twitter

I just have an option for my test runner that spits out timing info. ¯\_(ツ)_/¯

@Marcel XCTest has timing built-in. The point of running the test under Instruments is to see the reports on time spent in different methods, reference counts, file activity, user-defined signposts, etc. It’s really convenient to be able to quickly do that for just the code in a test method.

Leave a Comment