Why We Use KIF-Quick for User Interface Tests
At DoorDash our engineering teams are constantly building out new code to improve our user interface (UI) on iOS. Recently, we developed our own unique testing system that combines a framework called Keep it Functional with Quick, a behavior-driven development framework. We have seen that our KIF-Quick system provides the very best testing results and are proud to announce that that it’s an open source project, so we encourage others to take a look and give it a try.
To dive deeper, we chose to use Keep it Functional, or KIF for testing for many reasons, but one stands apart — reliability. We need to be able to trust that a test is 100% accurate, the test either passes or fails, everytime. KIF also tests quickly and with ease, which was a major draw to the framework. It’s key that a test does not take up too much time to run, while still providing reliable results.
At the same time, we also develop and write our unit tests in Swift and use the Quick and Nimble frameworks to help. For more context, Quick is a behavior-driven development (BDD) framework for Swift inspired by RSpec. We chose to use Quick because it is easier to read due to its organization, which helps making testing code a lot easier.
Using Quick for our iOS UI testing gives engineers more readable specifications with nested contexts. Plus, our UI tests benefit even more from BDD style when unit tests in our domain specific language are shared beyond the development. Which is why at DoorDash we have chosen to use the two in conjunction. KIF-Quick gives us hands down the best experience and results for UI testing because of its ease and reliable outcomes — because after all, they say “your code is only as good as your test”
Compare two examples of tests for app login below. The first example is using KIF-Quick and the other shows a regular XCTest.
KIF Test in Objective-C
As you can see from above two examples, the first (using KIF-Quick) offers more readable syntax, which is especially useful in organizing multiple contexts.
If you want to learn more, check out KIF-Quick here, we hope you find it just as beneficial for testing as we have.