Existing XCUITest cases and Appium

I have a number of XCUITest cases written for my app, both in Objective-C and Swift. I want to reuse these for UI Automation with Appium, meaning I don’t want to write those using Appium, but I want Appium to run those. Can I even do that? (Sorry, I did not see any tutorial etc around.)

Appium v1.7.0 uses XCUITest only, so you can reuse your cases.

https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md

Use this in your Desired Capability:

automationName: ‘XCUITest’

Thanks, I guessed that part, but it’s still unclear to as to how to do that. Is there any link/tutorial that you can point to?

(Basically, I have created a separate target and scheme to run my XCUI test cases, written mostly in Swift and some in Objective-C). In general, I can run them using command line in the following manner-

I first create the xctestrun using the xcodebuild command and the build-for-testing option.

xcodebuild -project /Users/braj/ios_proj/ios.xcodeproj -scheme ui-tests build-for-testing \
-destination "platform=iOS Simulator,name=iPhone 6 Plus,OS=10.3.1" \
-derivedDataPath /Users/braj/ios_proj/DevDerivedData | xcpretty; (exit ${PIPESTATUS[0]})

I then call the same command, but with the test-without-build option to run the UI tests from command line-

xcodebuild test-without-building -xctestrun /Users/braj/ios_proj/i/DevDerivedData/Build/Products/ui-tests_iphonesimulator10.3-x86_64.xctestrun -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.3.1'

How do I replicate these using Appium? Sorry, I found a lot of tutorials explaining setting up Appium and stuff, but have not really found one useful tutorial explaining the scenario I need.

Thanks in advance.

Sorry I’m not sure about this.

@Bhaskar_Raj you can not use same with Appium. you need build your client for simulator and get “*.app” file. which you can use with appium tests. then you choose any language (better Java as most supported) and starting your Java project.

check examples - https://github.com/appium/sample-code/tree/master/sample-code/examples