Writing test cases will take time initially, but once developers get used to it, it will make their lives easier in later stages. We, as developers, tend to integrate the API’s and then do the testing to check for response and UI updates. If there is any issue with API response, this process is repeated. Test cases come in handy as a means of avoiding this repetitive testing.
For example, to test a newly created API in fifth screen in navigation stack, it takes time to run the application, navigate to the respective screen and do a manual test to see if everything is working correctly. If something goes wrong, we have to repeat that process several times. Instead, if we have written a test case for the API, we can directly run that test case instead of executing the whole appm. Writing unit tests will take more time at the beginning, but it will save time later during testing or debugging.
Additionally, using test cases allows us to cover error cases like server errors, which are not possible to produce in manual testing.
In the coming article, we will learn how to Mock a Network Layer.
If you like this article, give some claps and follow me on Medium.