• Bytes Route logo

About testing an API

Cristi Minica

September 8th, 2020

Intro

Testing your API saves time and builds confidence. 100% code coverage is not what is the most important thing but to trust that your application behaves well as specified and adding new features or refactoring does not break something.

Types of testing

There are 2 types of testing, manual, and automated.

There are 3 types of automated testing, unit, integration, and end-to-end testing. And various flavors in between.

Manual testing is usually done by a testing engineer or, while developing the feature, by the developer.

Unit testing is testing the least complicated part of your code, hence the name, unit. Testing a unit of computing like a function. Even though the function might work well it does not guarantee that the whole project works together well.

Integration testing is the next level, it tests that the units of computing work together well and create more complex computing subsystems. We are not yet looking at the whole system from the user perspective but from the developer perspective. We are still testing code.

End to end testing is a simulation of what a user might do while using your application. This time we use the perspective of the user and test high-level features. If something breaks now, we know what broke but we don’t know why. In unit testing and integration testing, we know why it is broken but we don’t know what exactly broke.