I am completely beginner about UI and unit tests, and very confused about how to use them, as well as how to differentiate them. So I have thought about the following use case:
I have a user who has a set of MyData
, a simple object like this:
class MyData: NSObject {
var settled: Bool?
var id: String?
}
class User {
var datas: Set<MyData>?
}
Here is the behaviour of the application: the user comes on a MyDataListViewController
that's in a loading
state first, the viewDidLoad
method fires an asynchronous function, let's say we use Parse
for this:
static func loadDatas(success: ((Set<Data>) -> Void)?, error: ((String) -> Void)?) {
// Here we fetch the datas and return then in the success or an error
// ...
}
The callback result fills the controller's UITableView
, and when tapping a cell, it opens a modal popup for the specific MyData
with a button to change its settled
value.
myData.settled = !myData.settled
myData.save()
Given this information,
- How would I separate my UI and unit tests?
- How and what should I setup for each of these tests?
Thanks for reading me and helping me out, and sorry again if this sounds very beginner. I'm still very confused about the subject. Also, sorry if a better place than SO matches for this kind of question, I really didn't know where to ask.