Wednesday, September 10, 2025
HomeiOS Developmentxcode - Execute shell script earlier than UI Check for iOS app...

xcode – Execute shell script earlier than UI Check for iOS app begins


I’ve UI take a look at (for an iOS app) that opens iOS picture gallery and faucets on particular picture.
I wish to have customized script that may copy this picture to simulator’s picture gallery at first of the take a look at of even proper earlier than it is going to begin.

I’ve sh script that works once I manually run it after simulator is launched, however I would like it to be executed throughout take a look at run on Xcode Cloud.

That is script code

#!/bin/bash

# Get the UDID of the simulator (alter in your goal simulator)
SIMULATOR_UDID=$(xcrun simctl checklist gadgets | grep "Booted" | awk -F '[()]' '{print $2}')

# Path to the picture
IMAGE_PATH="./myImage.jpg"

# Add the picture to the simulator gallery
xcrun simctl addmedia $SIMULATOR_UDID $IMAGE_PATH

I already tried so as to add it to pre-test actions for Check Scheme and to Construct Phases of UI take a look at goal – no luck, I even wasn’t capable of finding logs associated to this script execution.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments