Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the difference between unit testing and integration testing when it come

ID: 649975 • Letter: W

Question

What is the difference between unit testing and integration testing when it come to web development (where 90-95% of the code relies on a database)? One thing I here all the time is that unit testing should not deal with databases and integration testing should. The issue I have with this is that to me that means the only difference between unit testing and integration testing is the data source and if that is the case, you are testing the same functionality. If the functionality that is tested is the same, why even bother with unit testing and always test against a database?

Explanation / Answer

Integration testing is about testing the integration points between 2 or more systems, this could be a database, it could be a web service.. whatever it is, it is interaction based, i.e. What happened to my component when it calls a stored proc that does xy and z? Has a web service changed its interface?

Unit testing deals with a single unit of work. Each unit test should test just one thing that method should do, this is where you stub out the database and any external interfaces or interactions.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote