Unit Test Frameworks

At the end of my previous article Pros and Cons of Using the C assert Macro for Unit Testing in C/C++ I promised to follow up with an article summarising the popular unit testing libraries/frameworks. In this article I will give that summary:

  • For the .NET languages there is NUnit. Although the source code is written in C# it can be used to unit test any .NET language. Sample code is supplied for C#, .NET C++ extensions (both managed and CLR) and J#
  • JUnit was developed for the unit testing of Java code and was the inspiration for many unit test frameworks that were to follow. JUnit is Java specific
  • For Python there is the Python Unit Testing Framework or PyUnit for short. PyUnit is part of the Python standard library as of Python version 2.1
  • For ISO standard C++ there are several unit test frameworks/libraries around. Probably the most popular are CPPUnit, The Boost Test Library and Aeryn. CPPUnit was an attempt to “port” JUnit to C++, whereas The Boost Test Library and Aeryn are in keeping with idiomatic modern C++

That concludes my roundup. Please comment if you feel I’ve missed a library that should have been included. Note that all the above libraries are open source (and in the case of Python, Python itself is open source).

Update

(Wed 11th Feb, 2009)

Thanks to Alan (see comments, below) for drawing my attention to SUnit - the unit testing tool for Smalltalk.

7 Comments

  1. Alan:

    It is worth noting that JUnit was inspired by SUnit and, like your comments about CPPUnit, doesn’t fit well with Java idioms - this was addressed by TestNG (although I understand JUnit has begun to evolve since I last used it).

  2. MarkR:

    Alan,

    Thanks for pointing out these things. I didn’t know about JUnit being inspired by SUnit. Actually I hadn’t heard of SUnit until your comment. I assumed Smalltalkers would have a unit test framework, so I probably should have looked it up and included it in the above article - I’ll append an update with a link to it.

    Re your comment that JUnit “doesn’t fit well with Java idioms”. I don’t know much about Java, but that did surprise me! Could you elaborate a little if/when you get chance? In what way is/was JUnit counter-idiomatic in Java, and how could it work such that it does fit with Java idioms?

    - Mark.

  3. Alan:

    Hi Mark - maybe an idea for your next post. I’ve just run into a codebase with a disturbing metric…

    grep “throw[^[:graph:]]*([^)]” `find -name \*.cpp -or -name \*.h` | wc -l
    222

    How about writing “The Only Good throw spec is an Empty One”?

  4. MarkR:

    Alan,

    Sorry about the delay in responding, and yes that is more than a little worrying!

    I see your code base is C++. Are you suggesting an article about throw specs in C++ or are you suggesing one that includes Java?

    - Mark.

  5. Alan:

    [No worries about the delay - I wasn't even sure you'd approve my comment as being on topic for this article.]

    Throw specifications in C++ and exception specifications in Java are very different beasts and treating them in the same article would only have value if the purpose were to explain the differences. That has been done.

    In terms of utility I don’t know of anyone that would argue the C++ version is anything other than a failed experiement. In Java the case is less clear as there are some benefits. (Although it is telling that no comparable, subsequent language has adopted this approach.)

  6. MarkR:

    Alan,

    [I assume you posted an off-topic comment because there was no logical place to post it, and no contact page for for sending me messages in general - I've now fixed this, you many notice a contact option has appeared on the main menue!]

    Unfortunately my Java knowledge is very rusty, and my understanding of the throw spec issues in Java is pretty much nebulous :-)

    C++ however - as you (Alan) know - is a very different matter! Thanks for the suggestion. It may be a few days before the article appears, but I’ll start work on it!

    - Mark.

  7. Mark:

    In a mixed C++ (or C) with .NET then I’ve found using NUnit for testing everything that is public works pretty well - especially if you have to test COM API’s. Consistency across the unit test results and software you need to install is a big benefit, especially if the code will eventually be called from .NET.

Leave a comment

?>shaved pussy hammered itsgonnahurt NEXTDOORPASS collegerules.com publicnude ungloryhole mouth with cock Charmane Star out in public VISCONTITRIPLETS GynoOrgasmVideos Ice La Fox smacked those asses public invasion Sexy big tits pornstar SpecialExamination outinpublic.com milfsoup evanrivers TOMMYDXXX Lacey lounging public invasion milfsoup tugjobs publicinvasion pussy pounded publicinvasion Nudesportvideos public invasion sexy blonde petite Bang Bros collegerules MedicalFemdom NEXTDOORPASS hazehim.com bang pas Confession Of Married Man fat pussy assparade BIGGEST ASS CRAVING outinpublic.com firm tits un glory hole Vince Ferelli outinpublic outinpublic fat mature redhead publicinvasion ungloryhole bait Bus MALEDIGITAL fucking ass and pussy Gyno Orgasm Videos milf lessons Bareblacking its gonna hurt collegerules Summer Bailey hazehim natural beautiful tits lucky stud in a hot threesome GAy Cumshots Extrem outinpublic tight ass drilled Nude sport videos CODYCUMMINGS submityourbitch itsgonnahurt.com haze him hazehim Big Mouthfuls Brooke Banner Aiden Aspen amazing blowjob public invasion publicinvasion dildo drills her pussy outinpublic.com submityourbitch Blonde round ass out in public hazehim out in public VINTAGEGAYLOOPS submityourbitch summer time milf Aiden Aspen submit your bitch CIndia Summers facialfest hazehim Lesbiansportvideos publicinvasion collegerules.com publicinvasion its gonna hurt trannyland Lesbian sport videos Blonde gets fucked hard Amy Reid Roxy Love Monsters Of Cock magical feet Licking Dick And Ass collegerules publicinvasion facial fest public invasion lesbian lover licks tugjobs Redhead BBW tranny land college rules porn star fucked hard lesbian dildo drilling sexy tit fuck NEXTDOORBUDDIES pussy covered Big Mouthfuls Charmane Star public invasion submityourbitch.com college rules trannyland.com itsgonnahurt tranny land submityourbitch.com natural perky tits SpecialExercises bangbus pound fucking NEXTDOORHOOKUPS ungloryhole tug jobs Special Examination Special Exercises busty adventures public invasion Milf cravers Stephanie Cane collegerules Medical Femdom assparade publicinvasion submit your bitch Gia Malone ungloryhole collegerules.com NEXTDOORMALE camel toe fuck team five 3DS Max 8 OEM3Q 3GP Video Converterdownload acdsee manager 2009 oemred eye remover pro 1.2cheapest windows vistacheapest windows vista ultimatecheap AutoCAD 2009Vision Backup Enterprisecheap Macromedia ColdFusionnero photoshow 5 downloadadobe photoshop cs oemcoldfusion mx 7 downloadkamagra sildenafil citratekamagra generic viagraorder caverta onlinecaverta 100buy cavertatadaliscasodex 50 mg tablet