Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,549

filter by tags archive

Unit tests vs. Integration tests

time to read 1 min | 128 words

I can sum it up pretty easily:

Unit tests:
65 passed, 0 failed, 5 skipped, took 7.49 seconds.

Integration tests:
45 passed, 0 failed, 0 skipped, took 284.43 seconds.

Except, there is one thing that you aren’t seeing here. Writing an integration tests is about as straightforward as they come. Execute the user scenario, assert the result. There is no real knowledge required to write the test, and they are very easy to read and understand.

Unit tests, however, often require you to understand how the software work in much finer detail, and they often make no sense to someone who isn’t familiar with the software.


John Chapman

Am I the only one that finds it shocking that 65 unit tests took 7.49 seconds to run? Based on that timing it sounds like the unit tests may be doing more than expected. I'm used to 65 unit tests taking a fraction of a second.

What kind of work are your unit tests doing? It almost seems like they would need some level of "integration" to make them that slow.

Igor Tamaschuk

And you are right. Moreover, every newbie in the test driven approach going to write the integration tests in first order. Especially if he is not strong enough in OOD and his design is like a one big transaction script with GOTOs :)

Ayende Rahien


That number also include the time to spin up the test framework, but yes, they are oing a lot

Paulo Aboim Pinto

I have this two levels of tests too. Usually the unit test mock the next layer (example testing Business Layer and mock the Data Access Layer).

In the integration test I will run some database scripts to create the database initial state and run the integration tests that will do on Business layer and I will not mock the DAL. The test will go to the end of the chain .. to the database.

this is the way that I do.. and that's why the integration tests take more time then the unit tests (in my case).


Paulo Aboim Pinto

Odivelas - Portugal

Comment preview

Comments have been closed on this topic.


  1. The worker pattern - 3 days from now

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats