Ayende @ Rahien

Hi!
My name is Ayende Rahien
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

@

Posts: 5,947 | Comments: 44,541

filter by tags archive

Unit tests vs. Integration tests


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.


Comments

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

John,

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).

Regards

Paulo Aboim Pinto

Odivelas - Portugal

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

No future posts left, oh my!

RECENT SERIES

  1. RavenDB Sharding (3):
    22 May 2015 - Adding a new shard to an existing cluster, splitting the shard
  2. The RavenDB Comic Strip (2):
    20 May 2015 - Part II – a team in trouble!
  3. Challenge (45):
    28 Apr 2015 - What is the meaning of this change?
  4. Interview question (2):
    30 Mar 2015 - fix the index
  5. Excerpts from the RavenDB Performance team report (20):
    20 Feb 2015 - Optimizing Compare – The circle of life (a post-mortem)
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats