Why Are Unit Tests Not Integration Tests?

TestFortExpert

2 m read

0%

Unit Testing

Spread the love

Surely there is a difference between tests known as Integration and Unit tests (U tests). Yet this difference is not too obvious in many testing laboratories. So where does the border lie? To answer that we are to understand what are Unit tests exactly and what do testers mean by integration tests?

Any Unit Test is

There simply are several qualities that are making U tests truly Unit:

  •  U tests are repeatable, meaning same test may be run for dozens of times or more
  • U tests do not change. Meaning it’s result is to be the same regardless of how many times is a tester running it
  • U tests require independence of whatever is not in memory (changing values) like data bases, networks, file systems, etc.
  • If it takes longer than, maximum, half a second for a U test run it’s not a good Unit test at all
  • U test is testing but one tiny peace (use case). Not more, otherwise things are getting over complicated. That’s exactly the reason why they are called U tests.

 

If all those required conditions are not met at their best tests will be of poor value as they would either be way too long to waste time on or will be false-positive in their majority meaning such tests are not to be trusted. Now that we are clear with unit tests…

Any Integration Test is

Every other test that is not fitting under the description given above. Integration tests vary from one another. There are system tests, performance tests, acceptance tests, whatever tests. They are all Integration as long as they are not Unit. What are the exact differences here?

  • Integration tests are using data that is changing constantly
  • Objects with little control over may be created
  • Integration tests often reach out to local or external system dependencies
  • The same test case may be testing multiple things at same time

 

This is making Integration tests:

  • Much slower than Unit Tests are
  • Harder to recreate and more difficult to run fully
  • There may be more issues with collecting result data

 

Does all of the mentioned above make Integration Tests useless? Surely, if they had zero value whatsoever no one would be using those now. Integration tests are best used when they were written beyond Unit Tests as an additional regression level. Or they are great with legacy code issues that was written before one started using Unit tests. And I am quite sure you may think of much more cases when Integration tests are to be used, right? Share ideas in comments!

SHARE YOUR PROJECT IDEAS
Realizing the importance of providing service on agreed terms, we consider all possible risks and provide efficient solutions for all possible risks and provide efficient solutions.












//
//




Your information was successfully submitted.

 

We are glad to have you with us!
You'll receive an email from us shortly. Meanwhile, you can check our super-informative blog to go through the latest updates in the world of software development.

Got it
We use cookies to ensure your best experience. By continuing to browse this site, you accept the use of cookies and "third-party" cookies. For more information or to refuse consent to some cookies, please see our Privacy Policy and Cookie Policy