jeudi 15 septembre 2016

What is test classes in Xcode?

I came from an IT education background and culture that is not accustomed or familiar with "test driven development". Long story short, I learned programming on Xcode on my current job, and after months of suppressing curiosity about this "test" and "UI test" files that kept appearing every time I created new project, I decided to look for it now that I have the time. That's where I learn the word "test driven development".

But surprisingly, there's so little articles out there for newbies that want to learn the basic concept about test driven development, let alone understand how to do it in Xcode. The articles I can found are all advanced materials, which assume the reader already familiar with TDD. The only QA I found in stack overflow that explain the basic about TDD is here, and that is not enough explanation because it only explain a very brief of what, not how. And also, it itself is tagged as duplicate to a QA link that's already removed from stack overflow. And the Apple's own documentation about writing test classes also assume that I'm already familiar with the concept either.

Can somebody gives a really simple example on how TDD works in writing Xcode project, particularly in Swift iOS? Like, what is my app code, what is my test code, and how the two are connected or related. I mean, I don't really understand the concept how writing a test code on test classes can help you "debugging" your main code.

Because from what I imagine from my interpretation of "testing", the test code must "simulate" how user enter data on the UI, try every possible combination of input, etc. And also, what's the difference between "test" and "UI test" ? How can code test a UI? Oh, and if you want to tag this question as "duplicate", please also give the link to where the duplicate is. Thanks.

Aucun commentaire:

Enregistrer un commentaire