I am trying to build and run test cases using command line for iOS test cases. I have given the following command:
xcodebuild -target AppEngineTests -configuration Debug -sdk iphonesimulator TEST_AFTER_BUILD=YES clean build
It builds the app but the testcases are not run.
could someone please help? Thanks
DESCRIPTION. xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an Xcode workspace or Xcode project. Usage To build an Xcode project, run xcodebuild from the directory containing your project (i.e. the directory containing the projectname.
Clean the Build Folder This will delete all of the products and intermediate files in the build folder. To clean the build folder you can use the shortcut Command+Option+Shift+K or Menu Bar → Product → Hold Option Key → Clean build Folder .
A base class for collecting information about a specific execution of a test.
xcodebuild provides several options for running unit tests. To build and run unit tests from the command line, execute the following command in Terminal: To build unit tests without running them from the command line, execute the following command in Terminal:
Note: xcodebuild runs your tests sequentially. For instance In Listing 17, xcodebuild will first test iOS in the Simulator before executing it on the iPod touch. How do I implement the Build For Testing and Test Without Building features from the command line?
The test action is what you use to run tests from a certain scheme in an Xcode project: If your app uses a workspace, perhaps because of CocoaPods, you'll need to pass the -workspace option instead of -project: -workspace MyAwesomeApp.xcworkspace. You can run instruments -s devices to see a list of know devices to use as the -destination option.
Command Line Tools Package for Xcode To be able to build and test your project using the terminal window you will need to have the Command Line Tools package installed on your machine. If the machine you want to build and run Xcode tests does already have Xcode 11 installed, then most likely you do already have the command-line tools installed.
I've found the name
property to require more specification.
xcodebuild test -workspace #{WORKSPACE_FILE} -scheme #{TEST_SCHEME} -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch),OS=7.0'
Was what finally worked for me. iPhone
was limited and/or unpredictable.
As another poster (can't find the citation) mentioned, the 'platform' loosely corresponds to the divider in the target list, 'name' corresponds to the sub-selection, and the OS
parameter corresponds to the right side of the chevron in the same list minus 'iOS '.
The documentation is suggestive and sounds authoritative on first glance without actually being full or correct, unfortunately.
Astonishing what a hassle this was. And how well it worked once the right invocation was achieved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With