Wann ist ein Test ein Unit-Test?

Standard

Entwickler schreiben ihre Tests normalerweise mit einem Unit-Test-Framework. Oft sind die Tests aber langsam und unlesbar. Fast immer liegt es daran, dass die Tests mit der Datenbank, dem Dateisystem, einem Web-Service oder einer anderen externen Ressource kommunizieren. Die Entwickler hören zuerst auf, die Tests regelmäßig auszuführen, und in weiterer Folge schreiben sie auch keine Tests mehr, weil “Unit-Tests” so langsam und schwer zu ändern sind.

Michael Feathers hat schon im September 2005 die Kriterien für Unit-Tests zusammengefasst:

“Ein Test ist kein Unit-Test, wenn:

  1. er mit einer Datenbank kommuniziert.
  2. er über das Netzwerk kommuniziert.
  3. er das Dateisystem anspricht.
  4. er nicht zur gleichen Zeit wie ein anderer Unit-Test ausgeführt
    werden kann.
  5. du spezielle Dinge mit dem Environment tun musst (z.B. Editieren
    von Konfigurationsdateien), um ihn auszuführen.

Tests, die diese Dinge machen, sind nicht schlecht. Häufig sind sie es
wert, geschrieben zu werden, und dafür kann ein Unit-Test-Harness
verwendet werden. Aber es ist wichtig, sie von echten Unit-Tests
trennen zu können, so dass wir eine Reihe von Tests haben, die wir
schnell ausführen können, wann immer wir unseren Code ändern.”

Entwickler schreiben also häufig gar keine Unit-Tests! Stattdessen handelt es sich um Integrationstests. Um echte Unit-Tests zu schreiben, gehört also mehr dazu als die Test-Attribute des verwendeten Unit-Test-Frameworks zu kennen.

98 thoughts on “Wann ist ein Test ein Unit-Test?

  1. wh0cd335792 [url=http://buyprednisolone.doctor/]methyl prednisolone[/url] [url=http://genericabilify.doctor/]generic abilify[/url] [url=http://cialisnopresription.doctor/]cialis[/url] [url=http://cheapantabuse.doctor/]antabuse[/url] [url=http://buypropecia.doctor/]propecia[/url] [url=http://buymetformin.doctor/]metformin[/url] [url=http://generickamagra.doctor/]kamagra[/url]

  2. Great blog you’ve got here.. It’s difficult to find excellent writing like yours
    these days. I seriously appreciate individuals like you!

    Take care!!

  3. I like the valuable information you supply in your articles.
    I’ll bookmark your weblog and check again here regularly.
    I am quite certain I’ll learn many new stuff right right here!
    Good luck for the following!

  4. My partner and I stumbled over here different web page and thought I might check things out.
    I like what I see so now i am following you. Look forward to going
    over your web page for a second time.

  5. I know this if off topic but I’m looking into starting my own weblog and was wondering what all is required to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet savvy so I’m not 100 certain. Any suggestions or advice would be greatly appreciated. Appreciate it

  6. Howdy would you mind letting me know which webhost you’re using? I’ve loaded your blog in 3 completely different internet browsers and I must say this blog loads a lot quicker then most. Can you recommend a good internet hosting provider at a honest price? Thank you, I appreciate it!

  7. I’ve been absent for a while, but now I remember why I used to love this web site. Thank you, I’ll try and check back more frequently. How frequently you update your web site?

  8. First off I would like to say fantastic blog! I had a quick question which I’d like to ask if you don’t mind.
    I was interested to find out how you center yourself and clear
    your head prior to writing. I have had trouble clearing my thoughts in getting my ideas out.
    I truly do take pleasure in writing but it just seems like the first 10 to 15
    minutes tend to be wasted just trying to figure out how to
    begin. Any ideas or hints? Many thanks!

  9. First off I want to say superb blog! I had a quick question in which I’d like to
    ask if you don’t mind. I was interested to find out how
    you center yourself and clear your thoughts prior to writing.

    I have had a tough time clearing my thoughts in getting my thoughts out there.
    I do take pleasure in writing but it just seems like the first 10 to 15 minutes are usually
    lost just trying to figure out how to begin. Any suggestions or tips?
    Kudos!

  10. Hi! I know this is kinda off topic but I was wondering which blog platform are you using
    for this website? I’m getting tired of WordPress because I’ve had problems with hackers and I’m looking
    at alternatives for another platform. I would be fantastic if you
    could point me in the direction of a good platform.

  11. I don?t even know how I ended up here, but I thought this post was great. I do not know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!

  12. Hiya, I’m really glad I have found this info. Today bloggers publish just about gossips and web and this is actually irritating. A good site with exciting content, that is what I need. Thanks for keeping this web-site, I will be visiting it. Do you do newsletters? Can’t find it.

  13. It is perfect time to make some plans for the future and it’s time to be happy. I’ve read this post and if I could I want to suggest you some interesting things or advice. Perhaps you can write next articles referring to this article. I desire to read even more things about it!

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

  15. I have been surfing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all web owners and bloggers made good content as you did, the web will be much more useful than ever before.

  16. Thanks for another informative site. The place else could
    I am getting that type of info written in such
    an ideal approach? I have a challenge that I am just now operating on, and
    I’ve been at the look out for such information.

  17. Oh my goodness! Amazing article dude! Thank you so much,
    However I am encountering problems with your RSS. I don’t understand why I am unable
    to join it. Is there anyone else having the same RSS problems?
    Anyone that knows the solution can you kindly respond?

    Thanx!!

Leave a Reply

Your email address will not be published.