开发者

Is there a way to "Test" current file in Xcode4?

Is there a way to "Test" current f开发者_如何学编程ile in Xcode4?

That is if you are writting your 10th unit test, but rather than going TEST and having all unit tests run, you want to only trigger running those testing in the unit test file you are current in?


Pretty old post, but Xcode evolved since.

In Xcode6, got to Product > Perform Action
You'll see some other Test options, like Testing the current function.

The shortcut is Cmd-alt-ctrl-U. Pretty difficult with a single hand if you're not a pianist.


It looks like Xcode 4 is heading that way, but it doesn't work well:

  • Edit scheme
  • Go to Test section
  • Expand to show checkboxes.

Unfortunately, you have to click individual checkboxes; there is no way to select the entire group, or even individual suites, and turn them off with a single click. Ideally, it would be nice to turn off everything, then reenable only the tests you want.

As a workaround, you can set up a test target containing the infrastructure to run any test, but not containing any tests. Call it something like "Ad-hoc Tests". Then take the test suite you want and temporarily add it to the target. Use the technique described above to turn off all tests in your main test target.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜