dwyl / dwyl/learn-apple-watch-development

UI Testing in XCode

Open
#39 2 comments 1 reaction 1 assignee Claimed by @sohilpandya View on GitHub
T4h technical
Dominant language
Swift
Stars
60
Forks
5
PR merge metrics
No merged PRs in 30d

Description

**Attaching my findings on using UI Tests.**

I've been researching UI Automation testing and XCode comes built in with the automation tools which will allow a user to do UI Testing.

The idea is very much like Daydream, where you start recording the user's movement through the screen and where they end up. The user can then test whether the action taken by the user has had any effect.

### What was my plan?

I set out a simple goal of being able to track the user when they add a new project. The steps required for this are:
- select add icon
- type the word "Test"
- select done
- the user will be redirected to the tableViewController where we can check if there is a row which contains the text "Test"

### How?

As long as we have UITest set up as a target for the project, it is straight forward to begin your journey in automation UI Testing.

- Select the `UITest` file that was autogenerated
screen shot 2017-06-13 at 17 35 28
- Then select the record button when your cursor is placed inside the testExample() test
screen shot 2017-06-13 at 17 36 44

This will open up the simulator and it will now record every click that is made by you and convert it into code inside of testExample()

**Issues**
Here is where we come across our the first issue, when we record the test, delete the code and repeat the process, it creates a different set of code. 😟 For e.g.
``` js
// First time
// let app = XCUIApplication() // This is one of the issues that pops up in UI Testing.
// Second time
// let app = app2
```

- Next step is run the test.

**Issues**
Here is where the next issue arises, the test created above where the user enters "Test" sometimes results in the automation test typing in "Est", "Tes", "es" but never the full word "Test". This means the test never passes.

### Next steps

- I'll try to research just a little more to find out if it's me causing this issue or the feature for automation testing is actually buggy.
- Next, I'll move onto a spike on Appium, which is an open source test automation software that works with native, hybrid and web apps.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.