Writing FIRST Swift Tests

Be a FIRST-class Developer!

Steven Curtis
4 min readOct 26, 2020
Photo by Nina Mercado on Unsplash

Prerequisites:

  • None, although the real example given below is quite in depth

Terminology

Unit test: Software testing where individual units or components of the software is Software testing where individual units or components of the software is tests

Why test?

Testing your classes is really important, giving confidence in your code and allowing programmers to both maintain your code (Good) and proof that your code meets the contract of what it should do.

When changes are made to code during development, breaking changes proves that code needs to be looked at again until all of the tests pass.

This is Test Driven Development, but having FIRST tests actually goes further than that.

What are FIRST tests?

  • Fast
  • Independent
  • Repeatable
  • Self-validating
  • Timely

so let us dive in and see what each of these mean in turn:

Fast Tests need to be quick, in such a such a way that developers won’t be discouraged from using them. Developers won’t run all…

--

--

No responses yet