Eric Ipsum
Eric Ipsum

Reputation: 745

run all test classes in xcode ui test

i am completely new to xcode ui application test. i have the source of the ios app. But i have to test the app using xcode ui test. currently i am adding new test classes to my ui test by creating new file and adding test cases by recording.

I can run my test class individually. But i want to execute all my test classes at a time. How i can do this.

I am completely new in this domain. Any kind of help will be appreciated.

U can also give me a ui test project link or any link which can help me. I have gone through the apple.developers website.

Upvotes: 0

Views: 8671

Answers (3)

MBH
MBH

Reputation: 16639

Fastlane is a great tool, but in case you would like to run all tests without installing Fastlane, here are some ways:

Testing with scheme:

xcodebuild test -scheme YourSchemeName  -destination 'platform=iOS Simulator,OS=15.2,name=iPhone 13'

Testing with scheme and Test Plan:

xcodebuild test -scheme YourSchemeName  -destination 'platform=iOS Simulator,OS=15.2,name=iPhone 13' -testPlan YourPlanName

Easiest Way: Running your tests from xcode directly, in the xcode menu:

Product -> Test (⌘ + U)

Upvotes: 1

Oletha
Oletha

Reputation: 7659

To run all of your tests, you can use the following command in Terminal:

$ xcodebuild test

Alternatively, you can use Scan for a simpler interface.

To automate the running of your tests, you can create a shell script to run this command. If you want the shell script to run automatically, use Jenkins or similar continuous integration software to run the shell script at specified intervals.

You can set a job up to run your tests using xcodebuild or scan, and send an email when the job completes, or just when it fails. There's an excellent blog post on how to install Jenkins on OS X here: https://nickcharlton.net/posts/installing-jenkins-osx-yosemite.html and I've written a blog post with notes about some things that might catch you out with the configuration: http://qualitytesting.tumblr.com/post/142473883709/building-with-jenkins-and-xcode. The email feature is available by default so you just need to configure the email addresses you want to receive the notification when you configure your job.

To run all the tests inside Xcode, you can use cmd+U or go to the Test Navigator on the left-hand side and click the play button that appears when you hover over your test suite.

Upvotes: 5

matsmats
matsmats

Reputation: 512

Not sure that I understand, but what happens when you press cmd-U?

Make sure that the UI tests are enabled for the scheme.

enter image description here

enter image description here

Upvotes: 7

Related Questions