Search code examples
macosjenkinsjenkins-pipelinejenkins-cli

Run macOS Test Cases on the Jenkins Pipeline


Hi I have an macOS Application which needs to be configured for CI/CD purpose on the Jenkins.

I need to run the test cases before making the application available for the distribution or before creating a package file.

I am using the below mentioned command

xcodebuild -workspace xxx.xcworkspace -sdk macosx11.3 -scheme xxx -destination "platform=OS X,arch=x86_64" clean test

when I execute this command in the Jenkins it throws me an error

ERROR: The test runner encountered an error (Failed to establish communication with the test runner. If you believe this error represents a bug, please attach the result bundle at /Users/ec2-user/Library/Developer/Xcode/DerivedData/xxx-gkolnyonjdnyixfknefsjvbsyzia/Logs/Test/Run-xxx-2021.05.24_11-58-07-+0000.xcresult. (Underlying Error: Couldn’t communicate with a helper application. Try your operation again. If that fails, quit and relaunch the application and try again. The connection to service on pid 0 named com.apple.testmanagerd.control was invalidated.))

I need to make use of macOS itself to run as a simulator. As Jenkins runs as a Daemon on the ec-2 instance.

NOTE: NOT USING XCODE PLUGIN TO EXECUTE MY COMMANDS

Please help!!!


Solution

  • My MacOS system was a slave and I was running my scripts through the Linux server. macOS was connected using the SSH earlier then this authentication method was required to be changed to access the UI of the Mac

    Test cases running now