When Is a Test a Unit Test?

Standard

Developers write their tests usually with a unit test framework. Often those tests are slow and unreadable. Almost always the tests communicate with a database, a file system, a web service or other external resources. Developers stop executing the tests regularly and further they stop writing tests entirely, because “unit tests” are so slow and hard to maintain. Michael Feathers has already summarized the criteria for unit tests in September 2005:

“A test is not a unit test if:

  • It talks to the database
  • It communicates across the network
  • It touches the file system
  • It can’t run at the same time as any of your other unit tests
  • You have to do special things to your environment (such as
    editing config files) to run it.

Tests that do these things aren’t bad. Often they are worth
writing, and they can be written in a unit test harness. However,
it is important to be able to separate them from true unit tests so
that we can keep a set of tests that we can run fast whenever we
make our changes.”

Developers often even do not write unit tests! They are writing integration tests instead. Sometimes it takes more than knowing the test attributes of the used unit test framework to write real unit tests!

17 thoughts on “When Is a Test a Unit Test?

  1. Hey! This is kind of off topic but I need some guidance from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick.
    I’m thinking about setting up my own but I’m not sure where to begin. Do you have any points or suggestions?
    With thanks

  2. My brother recommended I might like this blog.
    He was entirely right. This post actually made my day.
    You can not imagine just how much time I had spent for this
    information! Thanks!

  3. Hi there would you mind letting me know which
    web host you’re working with? I’ve loaded your blog in 3 different internet
    browsers and I must say this blog loads a lot quicker
    then most. Can you suggest a good web hosting provider at a fair price?
    Thanks a lot, I appreciate it!

  4. Hey there! This is kind of off topic but I need some advice from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but I can figure things
    out pretty fast. I’m thinking about making my own but
    I’m not sure where to begin. Do you have any ideas or suggestions?

    Thanks

  5. You can certainly see your skills in the article you
    write. The sector hopes for more passionate
    writers such as you who are not afraid to mention how they
    believe. Always follow your heart.

  6. magnificent points altogether, you simply gained a brand
    new reader. What would you suggest in regards to your put up that you just made some days in the past?
    Any sure?

  7. I loved as much as you’ll receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an nervousness over that you wish be delivering the following.
    unwell unquestionably come more formerly again as exactly the same nearly a lot often inside case
    you shield this increase.

  8. Thanks on your marvelous posting! I definitely enjoyed reading it, you can be a
    great author. I will be sure to bookmark your blog and
    definitely will come back later in life. I
    want to encourage you continue your great posts, have a nice evening!

  9. Having read this I thought it was rather enlightening. I appreciate you finding the time and energy
    to put this informative article together.
    I once again find myself personally spending a significant amount of
    time both reading and posting comments. But so what, it was still worthwhile!

  10. I spent four years trying EVERYTHING in Online Dating, and through a huge amount of trial and error, I produced a system that I will share for you. This book will take you, step by step, through everything you need to know to double, triple or even quadruple the number of women you meet online.

  11. Good post. I learn something totally new and challenging on blogs I
    stumbleupon everyday. It will always be useful to read through content from other writers and use a little something from other sites.

Leave a Reply

Your email address will not be published.