I have integrated iOS project with Jenkins. To run the automation test cases I am using the below code in shell script.
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
export CODESIGN_ALLOCATE=`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
xcodebuild -alltargets clean
xcodebuild -alltargets
xcodebuild -sdk iphonesimulator \
-project Myapp.xcodeProj \
-scheme Myapp-cal \
ONLY_ACTIVE_ARCH=NO \
CONFIGURATION_BUILD_DIR="$WORKSPACE/build" \
clean build
cucumber
The automation testing is working fine in xcode where as with Jenkins getting the below error.
Unable to auto detect APP_BUNDLE_PATH. Have you built your app for
simulator? Searched dir:
/Users/test/Library/Developer/Xcode/DerivedData/Myapp-fayplezntrxmdqeteknsfkkvtzla/Build/Products
Please build your app from Xcode You should build the -cal target.
Help appreciated
I believe all you need to do is export your APP_BUNDLE_PATH in your script before you call cucumber.
Something like this:
export APP_BUNDLE_PATH="${WORKSPACE}/build/Build/Products/Debug-iphonesimulator/Myapp-cal.app"
cucumber
To see an example of this in the wild see the briar-ios-example repo. [1]
FYI/BTW APP and APP_BUNDLE_PATH are interchangeable. [2]
[1] https://github.com/jmoody/briar-ios-example/blob/master/Briar/jenkins-calabash.sh
[2] http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html
Deleting the contents of /Library/Developer/Xcode/DerivedData and compiling again solved this problem for me. I did not wanted to hardcode the APP_BUNDLE_PATH as I have multiple targets.
My error message was Unable to auto detect APP_BUNDLE_PATH.
Related
I am facing a strange issue:
I am trying to build using this xcode command
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id={deviceID}' test
But every time I run this command I see an unusual prompt that shows up in the next line --
quote]
I am not sure what quote means and what I am expected to enter. I tried entering other device attributes but still it din help me .
Could some one please help me?
As far as I understand your provided information you are trying to start a test on a real device. Tests are executed on simulator only, which is why Xcode tells you it's not able to build your project.
Try something like this instead:
xcodebuild \
-project WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' \
test
As you can see this command tries to build your project on an iPhone 6 simulator with iOS 8.1 installed. You can define this to your liking (e.g. OS=13.0 or another iPhone/iPad).
You can give these reads a try, too, for more examples and a better understanding:
https://www.mokacoding.com/blog/running-tests-from-the-terminal/
https://www.appsdeveloperblog.com/run-xcode-unit-tests-from-the-command-line/
I'm trying to automate iOS building through CMake, up to and including authoring .ipas. I have my provisioning profile and certificates set up, build is successful, but when I execute cmake --build I can't get .xcarchives to generate, and my POST_BUILD command (using xcodebuild) to author the .ipa is dependent on that.
I've tried setting some archive options though CMake (setting cmake_archive_output_directory), but there's a flag or option to set that can produce xcarchives during build, I don't know it. Does anyone have experience with this?
Despite many attempts, a post-build command to xcodebuild archive never worked -- I'm still not sure why, either. What I ended up doing to work around this was have CMake generate a script.
So my create executable custom function does this:
It creates a script file if it doesn't already exist, then for each executable target, appends an xcodebuild command if it's not a duplicate:
xcodebuild -workspace ${pathToTargetWorkspace} -scheme ${targetScheme} -configuration ${config} -archivePath ${pathToGeneratedArchive}.xcarchive archive
Then after building is finished, you just run the script with the aggregation of archive commands and it archives all the targets.
Is there a way to actually create UI Tests in Xcode8 via the terminal? I am aware that UI Tests are usually created via Xcode itself but i would like to do it via the terminal and automate the whole process. Thanks!
you can use xcodebuild command to run the test in Xcode.
like:
xcodebuild -workspace ${WORKSPACE_NAME} \
-scheme ${SCHEME_NAME} \
-destination "${DESTINATION}" \
-derivedDataPath "${OUT_PATH}" \
test
do not forget to set the scheme shared.
since yesterday I'm trying to make OCLint works with my iOS project.
What I've done so far is to follow these instructions to install OCLint, then I've followed these other instructions to use it within Xcode. The problem is that when I try to build the OCLint aggregate target the build process never end (I've waited 30 minutes before stopping it). Is someone experiencing the same issue? the OCLint version I'm using is oclint-0.9.dev.3f9355e
try this on Terminal
xctool -workspace xx.xcworkspace -scheme xx -reporter json-compilation-database:compile_commands.json clean
xctool -workspace xx.xcworkspace -scheme xx -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database
I want to build a Xcode project from Terminal and then run it as required, also from Terminal.
I have been looking for a way to do this for a while now but only managed to find a method which works for the iPhone Simulator, not for the actual device it self.
Is this even possible? The reason I want to a Xcode project on a device from Terminal is because the application runs a series of automated tests and I would prefer to automate this process using a bash script.
Thanks
To build your xcode project from the command line using a bash script use:
/usr/bin/xcodebuild -target TargetYouWantToBuild -configuration Debug
Look at the man page for xcodebuild for more options.
We do this for our unit test suite target, and we use GHUnit.
This is the section of our build script for running the tests:
export GHUNIT_CLI=1
export WRITE_JUNIT_XML=1
clean
echo "Building Bamboo GHUnit Tests..."
OUTPUT=`/usr/bin/xcodebuild -target BambooAutomatedUnitTest -configuration Debug -sdk iphonesimulator4.3 build`
RESULT=`echo "$OUTPUT" | grep "\\*\\* BUILD "`
if [ "$RESULT" != "** BUILD SUCCEEDED **" ]
then
echo "$OUTPUT"
exit 1
fi
echo "${RESULT}\n"