To run your unit tests in the simulator using xcodebuild
use
If you have a workspace (e.g. when using CocoaPods)
xcodebuild \
-workspace MyApp.xcworkspace \
-scheme "MyScheme" \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' \
test
If you have a project file
xcodebuild \
-project MyApp.xcproj \
-scheme "MyScheme" \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' \
test
Alternative destination
values are
-destination 'platform=iOS,id=REAL_DEVICE_UDID'
-destination 'platform=iOS,name=IPHONE NAME'