'Module was not compiled for testing' when using #testable does not resolve this post issue.
I am integrating Xcode project with CI/CD by using jenkins and fastlane. My Xcode project build success if project do not have test cases. If I added my test cases then xcode build failed in jenkins with error:
error: module 'JenkinsFastlaneExample' was not compiled for testing
ScreenShot of error
In one post I found answer to set scheme flag, I made same like answer but didn't work for me.
My test cases are also successful in Xcode 11.x , iOS 13.x. tested in iPhone XR
I unable to find out why jenkins build is failed.
Demo Repo (if needed) : https://github.com/thedahiyaboy/ios_jenkins_example
Edit:
I also tried to disable my test cases from Xcode so that I can run my cases from mac system only and with hope jenkins will skip test bundles, but getting the same issue.
In jenkins, configuration was Release (by default) which was unnoticed by me, after replacing it to Debug my build is succeeded.
Reference Image:
Reference Doc:
https://plugins.jenkins.io/xcode-plugin/
Special thanks to Scriptable for giving time and efforts for solving the issue.
Related
We are setting up CI/CD for iOS project using Gitlab & fastlane tools on Mac Mini(M1 Chip).
When there is a new pull request created, pipeline starts and it executes below command success.
fastlane ios build
But it shows "no such module 'Alamofire'" error for below command.
fastlane ios test
Other observations on same build machine Mac Mini(M1 Chip):
It shows same errors "no such module 'Alamofire'" when try to build or run tests using Xcode(Uncheck Open using Rosetta).
Both build & run tests works fine with Xcode(Check Open using Rosetta).
We are looking for build the iOS project and run unit tests on simulator for new/update pull request. Build works fine but run unit tests fails during compilation.
Any help on this would be greatly appreciated.
You are using cocoapods to import Alamofire right?
Do you happen to have any post_install steps that are setting build_settings in your podfile?
I have a framework project which gets build using a shell script under Build Phase. It uses xcodebuild to do that.
Since I have updated the Xcode to 11.4, I am getting the following error when the consuming project tries to build the dependency for above framework( The same works fine when I build the framework on it's own).
unable to create directory '/Users/.../Library/Developer/Xcode/DerivedData/App-cnatioifembsmzdvoyyuogceigiw/Build/Intermediates.noindex/ArchiveIntermediates/AppName-Staging/BuildProductsPath/Debug-iphoneos/FrameworkName.framework' (in target 'TargetName' from project 'ProjectName')
I have checked the write permission on the directory. I have given full hard disk access to Xcode under Security and Privacy but it is still happening.
Any guidance will be appreciated.
Thanks in advance.
I have experiencing really weird build error. It all builds well for a normal target but since an update to Xcode 7.3 the Tests target started throwing error
"cdtool cannot compile" on one of my model versions "CoreData 9.xcdatamodel"
during the build. The project builds and runs perfectly for a normal, non test target.
I checked in on different Macs and even on an external CI provider (bitrise.io) - the issues exists everywhere.
I'm using Cocoapods and KIF to run Continuous Integration on an Xcode server. I have successfully set this up for one project to report on each commit. I'm now using a second project and get the error:
Bot Issue: warning. Build Service Error.
Issue: archive at path '/Library/Developer/XcodeServer/Integrations/Integration-81d42936b22a04037fd4aebed1074e5e/Archive.xcarchive' is malformed.
Integration Number: 1.
Description: archive at path '/Library/Developer/XcodeServer/Integrations/Integration-81d42936b22a04037fd4aebed1074e5e/Archive.xcarchive' is malformed.
The tests passed when ran on the Xcode server machine using Xcode. I tried downloading Provisioning Profiles etc via Xcode but that didn't help. I deleted the Bot and created a new one but that also did't help.
Any help is welcome
At least in my case (and there may be multiple causes), this was caused by having "Skip Install" set on every target, which causes you to end up with an empty archive (but only on Xcode Server).
Basically, xcodebuild (the command-line tool) has lots of critical differences from Xcode in the way it handles archiving. It builds targets that aren't listed in the scheme, and it obeys the Skip Archive flag even for targets listed in the scheme. By contrast, when building locally, Xcode ignores the Skip Archive flag and archives any targets in the scheme (and only the targets listed in the scheme).
I would encourage you to file a bug every time you run into situations where a project builds locally but fails on the server. If everyone did this, perhaps these differences would eventually get fixed....
I've set up jenkins on my local machine. Than I created a sample app with one failing and one succeeding unit test. When I issue the following command in the terminal
xcodebuild -scheme 'SampleWithTest' -sdk iphonesimulator7.0
-destination platform='iOS Simulator',OS=7.0,name='iPhone Retina (3.5-inch)' clean test
than it clean build the project, starts the simulator and makes the tests. This is how it should work.
When I run the same command via jenkins, it clean builds the project and ends with ** TEST SUCCEEDED ** without starting the simulator or print out the test results. Jenkins just fakes, that the tests was successful.
I test it on my local machine. Nothing headless, remote, source control, slave, code signing or whatever could make any trouble.
The Jenkins Xcode Plugin has not been updated to work with Xcode 5 and the XCTest framework. See this issue. Jenkins and the Xcode Plugin do not understand XCTest output.
Additionally, Xcode 5 changed how Xcode interacts with the simulator and devices when running tests. While there is something like a "headless mode" now for the simulator, access to that functionality isn't available to the Xcode plugin. This means that in some cases, it looks to the Xcode plugin as if the tests run and exit immediately, which is not accurate.
Xcode is known to be pretty tricky to setup with Jenkins, Travis or other non-Apple CI solutions.
Unit Tests support is even worse so you should try using xctool instead.
Related blog entry here.