Make it easier to add more stable tests to your suite
When translating a Test Case (TC) to an automated script, you should think very carefully about what exactly you’re testing, to avoid the need of fixing the test every time a single label changes.
Let’s say you have a TC to assert a search-result flow:
TC123 - Validate Search TermTest Steps:
1. Open app
2. Type "Xcode" on search field
3. Tap "OK" buttonExpected Result:
3. The app should go to Results View with "Result for Xcode" as title.
let app = XCUIApplication()
I will show you a way to identify what you should test and some concepts to make your life a little easier when writing tests.
At some point in my career I knew how important unit tests were, but I didn’t know how to test my code. Many have faced the same issue. We read articles on how to start, but still, it’s hard to apply what we’ve learnt to our own code. We usually don’t have those functions that just sums up two parameters and returns the result, and we see it in many examples out there. …
Let’s write a decoupled code and by using composition even be able to test our ViewController! 😱
When I had to write a QR code scanner app I had never used AVFoundation before. So I followed the usual script: I read a bit of documentation, went through some tutorials, and applied the new knowledge to my needs. The problem with the common way out there is it makes the ViewController conform to one more protocol. Thus, it adds another responsibility!
I’ll show you a better approach using a simple app as an example.
iOS Developer, learning and sharing in the process