Skip to content

How to start with XCUITest from Scratch?

Suparna edited this page Oct 19, 2019 · 2 revisions

How to start with XCUITest from Scratch?

Pre-requisites:

To test an iOS app using XCUITest, we may require the below: • an iOS demo app • Language: Swift or Obj C • UI Test Frameworks • GitHub account • Xcode • SourceTree

  1. Login to your personal GitHub Account.
  2. ‘Fork’ a copy of an iOS demo test app such as in https://github.com/appium/ios-test-app
  3. Post successful forking, a working copy of the forked branch will be added to your list of GitHub ‘Repositories’.

https://drive.google.com/open?id=1LC0JE2sQXRBO-zeqee024i0KP6v6G6vj

  1. Go to your newly forked repo branch and copy the git url: https://github.com/suparna-khamaru/ios-test-app.git

https://drive.google.com/open?id=1olvTVfkKKVyTQ0qMZc_692hPaosFBbnZ

  1. Go to SourceTree (Install if not present)
  2. In SourceTree -> Click on ‘New’ -> Click on “Clone from URL” -> Paste the copied url in Source URL -> Automatically the other fields should be auto-populated in seconds -> Select ‘master’ -> Click on ‘Clone’ button -> Save it in a PC location of your choice

https://drive.google.com/open?id=16m-HDgvo8UqGgdIFheyD9Xk6oAwxydEW

  1. Open Xcode -> File -> Open -> Open the above cloned local project file ‘TestApp.xcodeproj’

https://drive.google.com/open?id=1Y0467DVFzHObhVwhYHGYcW49yr3IBTOf

  1. On opening the project, the default iOS app can be observed. Our aim is to add another Target (for UI Test) to the displayed project.

https://drive.google.com/open?id=1wF8LyUdOhOpAP_g5gHHAxiydv6RGnT-c

  1. Xcode -> Editor -> Add Target -> Select “iOS UI Testing Bundle” -> Next

https://drive.google.com/open?id=12jut6pcuvANcdiiEihpuBOYqfLQ4scH-

  1. Choose a suitable name for the test suite in Product Name field such as ‘UITests’ -> Click Finish (if all the populated fields look okay)

https://drive.google.com/open?id=1SvSzhAAWeebE9UyI_9RWGWhUzDchdbfK

  1. By end of this step, you must be able to see that the target for UITests are created in project.

https://drive.google.com/open?id=1ZtFYC1tiDiIlXnsCt9reAyG8fj-mxYrv

  1. Go to ‘UITests’ folder and start developing a test framework for testing the iOS app like any tester/end user.

  2. By default, Xcode creates a sample class with sample syntaxes to run demo test (with nice descriptions for users to start from here)

https://drive.google.com/open?id=1P-8CDmrZHL_oc0pjCEB7JA-a2ReDLTUH

Clone this wiki locally