# iOS Unit Testing and UI Testing Tutorial | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048>\
**Category:** 🎓 Courses & Articles\
**Created:** [April 8, 2019, 3:59pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048 "2019-04-08T15:59:03Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [April 8, 2019, 3:59pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/1 "2019-04-08T15:59:03Z")

</div>

Learn how to add unit tests and UI tests to your iOS apps, and how you can check on your code coverage.

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/960290-ios-unit-testing-and-ui-testing-tutorial](https://www.raywenderlich.com/960290-ios-unit-testing-and-ui-testing-tutorial)

---

<div class="post-metadata">

**Author:** ![alsargent](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/alsargent/32/81327_2.png) [@alsargent](https://forums.kodeco.com/u/alsargent)\
**Post date:** [April 9, 2019, 10:49pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/2 "2019-04-09T22:49:43Z")

</div>

Thanks. If anyone’s interested in adding visual UI testing for their iOS apps, this tutorial explains how to do so: [Testing native iOS apps using XCUI | Applitools Tutorials](https://applitools.com/tutorials/xcui-swift.html#install-the-sdk)

(Disclaimer: this is for a commercial product called Applitools, where I work.)

---

<div class="post-metadata">

**Author:** ![capitainecaverne](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/capitainecaverne/32/103567_2.png) [@capitainecaverne](https://forums.kodeco.com/u/capitainecaverne)\
**Post date:** [April 18, 2019, 8:53am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/3 "2019-04-18T08:53:47Z")

</div>

Thanks for this great and interesting tutorial.

However, I’d like to know if XCUITEST can be used to check some VoiceOver implementations including custom actions to be fired.  
I’m not sure this is possible because I understood that only elements on screen are reachable… and that’s definitely not the case with custom accessibility elements and custom actions.

Could you give me your point of view about XCUITEST and VoiceOver, please ?  
Thanks in advance for your return.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [April 30, 2019, 3:54am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/4 "2019-04-30T03:54:37Z")

</div>

@mkatz Can you please help with this when you get a chance? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![mkatz](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mkatz/32/108269_2.png) [@mkatz](https://forums.kodeco.com/u/mkatz)\
**Post date:** [April 30, 2019, 11:45am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/5 "2019-04-30T11:45:56Z")

</div>

I’m not sure that you can, but maybe someone in the official forums knows. If you do find out, please update us here.

In our apps we use view models so we have unit tests on the view models that check for the custom a11y elements. This is backed up by manual testing of voiceOver.

---

<div class="post-metadata">

**Author:** ![mogleygull](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mogleygull/32/81494_2.png) [@mogleygull](https://forums.kodeco.com/u/mogleygull)\
**Post date:** [June 6, 2019, 12:49pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/6 "2019-06-06T12:49:03Z")

</div>

I’m currently making a buyback business and use mobile device diagnostic software [url=https://www.nsysgroup.com/en/][https://www.nsysgroup.com/en/[/url]](https://www.nsysgroup.com/en/%5B/url%5D) for testing and it is a really worthy application.

---

<div class="post-metadata">

**Author:** ![capitainecaverne](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/capitainecaverne/32/103567_2.png) [@capitainecaverne](https://forums.kodeco.com/u/capitainecaverne)\
**Post date:** [June 24, 2019, 11:58am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/7 "2019-06-24T11:58:45Z")

</div>

Hi everyone, _(answer for **mkatz** )_

During the WWDC 2019 WWDC19 Accessibility and Testing Labs, the Apple engineers said that the reason why accessibility is not available during UI testing are security concerns: that’s definitely not possible right now unfortunately.

---

<div class="post-metadata">

**Author:** ![jason18401](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jason18401/32/81494_2.png) [@jason18401](https://forums.kodeco.com/u/jason18401)\
**Post date:** [August 22, 2019, 1:53pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/8 "2019-08-22T13:53:39Z")

</div>

I’m confused where we got the 90 from so 90+5=95?  
Thanks

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [August 29, 2019, 5:37pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/9 "2019-08-29T17:37:26Z")

</div>

hi Jason! sorry, I’ve been offline for 10 days.

It’s not that 90+5 = 95. The test sets the guess value to 5 more than whatever the (random number) target value is. This means the guess is always off by 5 so, If the score calculation is correct, the score should be 100 - 5 = 95.

---

<div class="post-metadata">

**Author:** ![draconiferous](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/draconiferous/32/81494_2.png) [@draconiferous](https://forums.kodeco.com/u/draconiferous)\
**Post date:** [September 14, 2019, 9:11am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/10 "2019-09-14T09:11:25Z")

</div>

Hi,

Thanks for such a great tutorial.  
However I was little bit confused and felt that in starting of the tutorial if more coverage is given on functions called from tests than it could give more clarity. Writing test over already created project, it is somewhat hard to grab.

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [September 14, 2019, 9:37am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/11 "2019-09-14T09:37:22Z")

</div>

hi Deepanshu! there’s a really interesting approach called test-driven development — start with this [tutorial](https://www.raywenderlich.com/5522-test-driven-development-tutorial-for-ios-getting-started), then maybe look at our [book](https://store.raywenderlich.com/products/ios-test-driven-development).

---

<div class="post-metadata">

**Author:** ![singflan](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/singflan/32/85244_2.png) [@singflan](https://forums.kodeco.com/u/singflan)\
**Post date:** [September 17, 2019, 3:49am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/12 "2019-09-17T03:49:56Z")

</div>

Hi, on the 3rd test HalfTunesFakeTests.swift, getting the path is returning nil. I believe it’s because the test bundle path is incorrect but I’m not sure what’s incorrect as it’s exactly the same as the tutorial. Any help? ![34%20PM](https://files.chunter.kodeco.com/original/3X/8/c/8c74f98997964dd00c137458feebc93be2380ffe.png)

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [October 14, 2019, 10:56pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/13 "2019-10-14T22:56:24Z")

</div>

@mkatz Do you have any feedback about this? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [October 15, 2019, 12:39am UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/14 "2019-10-15T00:39:40Z")

</div>

hi Dustin! sorry, I didn’t see this earlier.

I just downloaded the materials and the test ran OK. Check your files, maybe you need to download again. Here’s what I have:

![01](https://files.chunter.kodeco.com/original/3X/9/4/94e7bc919c6a34c563422005cffb099c98b02915.png)

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [November 15, 2019, 5:15pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/15 "2019-11-15T17:15:59Z")

</div>

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [November 15, 2019, 5:16pm UTC](https://forums.kodeco.com/t/ios-unit-testing-and-ui-testing-tutorial-raywenderlich-com/67048/16 "2019-11-15T17:16:02Z")

</div>

Closed on November 15, 2019, 5:16pm UTC


