Sunday, May 24, 2020

Unit vs Integration Testing

* Developers should run unit tests and then commit the code. (best practice)

* One of the golden rules of unit testing is that your tests should cover code with “business logic”.

In this case, the highlighted part in gold is where you should focus your testing efforts. This is the part of the code where usually most bugs manifest. It is also the part that changes a lot as user requirements change since it is specific to your application.

* So what happens if you get across a legacy application with no unit tests? What if the “business logic” part ends up being thousands of lines of code? Where do you start?
In this case you should prioritize things a bit and just write tests for the following:
1. Core code that is accessed by a lot of other modules
2. Code that seems to gather a lot of bugs
3. Code that changes by multiple different developers (often to accommodate new requirements)
How much of the code in these areas should we test, you might ask. Well, now that we know which areas to focus on, we can now start to analyze just how much testing we need to feel confident about our code.




Reference :
https://zeroturnaround.com/author/kostis-kapelonis/


No comments:

Post a Comment

Thank you for your comment!