Support for specifying a test class and method when running "xcodebuild test"

Originator:IskanaMagus
Number:rdar://15750338 Date Originated:05-Jan-2014
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Enhancement Reproducible:Not Applicable
 
Summary:
While refactoring an existing class or building new functionality into an application in a test-driven style, running a script to monitor the file system for changes and re-run the test suite in the background gives a developer a steady update of the state of the existing behaviors in the app and whether breakages have occurred during development. However, when a test suite becomes large and requires more than a second or two to run, using a more focused script for running individual tests reduces the amount of lag between feedback cycles when tests break.

Current development tools have partial support for this functionality:

* Xcode can run individual tests from Test Navigator context menu, but is not easily automated to run tests as files change.

* The xcodebuild binary has the ability to run a project's tests, but only the entire suite at once.

* The otest and xctest binaries support specifying an individual test as a command-line argument like "-test <TestCaseClassName/testMethodName>", but do not automatically have the proper library and framework paths configured as needed like xcodebuild.

Proposed Solution:

Add a "-testScope" option to xcodebuild, which can then be passed to otest and xctest to run an individual test class or test method. Tests could then be run like:

    xcodebuild -testScope "MappingsTests/testSupportsManyToMany" test

and output the results of running a single test, or preferably also support:

    xcodebuild -testScope "MappingsTests" test

which would run all of the tests in the MappingsTests class.

Steps to Reproduce:
Run "xcodebuild -testScope <TestCaseClassName/testMethodName> test" from a terminal

Expected Results:
Only the specified test class is run.

Actual Results:
Specifying an individual test class is not supported.

Version:
Version 5.0.2 (5A3005)

Notes:


Configuration:


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!