The Artima Developer Community
Sponsored Link

Weblogs Forum
The Way of Testivus - Unit Testing Wisdom From An Ancient Software Start-up

20 replies on 2 pages. Most recent reply: May 21, 2007 1:09 PM by Alberto Savoia

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 20 replies on 2 pages [ « | 1 2 ]
Alberto Savoia

Posts: 95
Nickname: agitator
Registered: Aug, 2004

Re: The Way of Testivus - Unit Testing Wisdom From An Ancient Software Star Posted: May 15, 2007 8:20 AM
Reply to this message Reply
Advertisement
Hi Bill,

Sorry for the delay in replying, I was busy with JavaOne.

I haven't used C++ in 10 years (saved by Java!) but when I worked at Google (where there was, and still is, a fair amount of C++ code) I remember people using CPPUnit with good results. It has more overhead than JUnit, but it gets the job done. Have you tried the following tutorial?

http://www.comp.nus.edu.sg/~cs3214s/tools/cppunitVC.html

I should also mention that in addition to using existing tools and automation, developers should consider developing their own "mini"-tools and automation.

xUnit frameworks make some tasks easier, but you can write self-checking tests without them.

Here's a trivial test.


public static testAddition() {
int sum = 2 + 2;
Assert.assertEquals(4, sum);
}


I can write a class Assert with various assert methods. For example:


public void assertEquals(int n1, int n2) {
if (n1 != n2)
throw new RuntimeException("Test failure. Expected " + n1 + ", but got " + n2);
}


Then a simple runner (yes, I'd have to add the tests by hand, but with a bit more code I can take advantage of Java's introspection, scan for tests, and run them automatically).


public void runMyTests() {
testAddition();
}


When I execute runMyTests() if an assertion fails, I get a runtime exception with a stack trace.

JUnit offers a lot very nice bells and whistles to make all of this cleaner and simpler, but the essence of a test framework is a library of assertions and a test runner.

No excuses :-).

Alberto

Alberto Savoia

Posts: 95
Nickname: agitator
Registered: Aug, 2004

Re: The Way of Testivus - Unit Testing Wisdom From An Ancient Software Star Posted: May 15, 2007 8:24 AM
Reply to this message Reply
> Nice stories about ancient programming teams, and how
> things should be done are interesting, but they are of no
> help when you can't get the basic tools to work.
>
> Bill

You might also check this page from Philippe on simple (easy to DIY) frameworks.

http://pantras.free.fr/articles/cutindex.html


Alberto

Doug Anderson

Posts: 5
Nickname: dougbangko
Registered: Apr, 2007

Re: The Way of Testivus - Unit Testing Wisdom From An Ancient Software Star Posted: May 15, 2007 8:43 AM
Reply to this message Reply
Alberto, one suggestion:

Add your web site address in the PDF, just under your name, on the first page.

Also add a copyright line, but also add "may be circulated freely, providing no changes are made".

Then the PDF can be circulated and each copy will point back to your site, increasing your web presence. This is called "viral marketing".

Doug

Brian DeVries

Posts: 1
Nickname: cplan
Registered: Oct, 2006

Re: The Way of Testivus - Unit Testing Wisdom From An Ancient Software Star Posted: May 16, 2007 11:04 PM
Reply to this message Reply
Bill Burris,

This blog entry seems to go over several C++ unit testing libraries. I think the author has his own, called UnitTest++. C# uses NUnit, but I haven't gotten into the .NET stuff yet, so I haven't had occasion to use it.

Philippe Antras

Posts: 2
Nickname: pantras
Registered: May, 2007

Re: The Way of Testivus - Unit Testing Wisdom From An Ancient Software Star Posted: May 21, 2007 12:14 PM
Reply to this message Reply
> Would it be too much to ask for a French translation? :-)
> P.S. I have put a nicely formatted version on
>
> http://www.agitar.com/downloads/TheWayOfTestivus.pdf

Hi Alberto,

good idea, here is the translation:

- Si tu écris du code, écris des tests.
- Ne bloques pas sur les dogmes des tests unitaires.
- Suis le karma des tests unitaires.
- Penses que le code et ses tests n'en font qu'un.
- Test est plus important que unitaire.
- Le meilleur moment pour tester est quand le code est frais.
- Les tests non executés meurent lentement.
- Un test imparfait aujourd'hui vaut plus qu'un test parfait demain.
- Un mauvais test vaut mieux que rien.
- Des fois le test justifie les moyens.
- On reconnait le bon ouvrier à ses outils.
- Les bons tests échouent.

I took the liberty to replace the "only fools use no tools" with a french proverb which could translated as "one recognize the good worker from its tools". I you prefer the literal translation, it would be "Seuls les idiots n'utilisent pas d'outils". Feel free to use it as you wish.

The poster in french, which could have been found in the ruins of a french subsiduary of your ancient start-up :o) can be found there: http://pantras.free.fr/images/testivus-fr.PNG

I also create an entry in the french wikipedia (http://fr.wikipedia.org/wiki/Testivus ), and I may tranlate it all.

> P.S. I have put a nicely formatted version on
> http://www.agitar.com/downloads/TheWayOfTestivus.pdf
Yes I saw it, nice work, don't know how it'd print though, did someone out there try ?

Cheers,
Philippe

Alberto Savoia

Posts: 95
Nickname: agitator
Registered: Aug, 2004

Re: The Way of Testivus - Unit Testing Wisdom From An Ancient Software Star Posted: May 21, 2007 1:09 PM
Reply to this message Reply
Merci beaucoup Philippe!

>I took the liberty to replace the "only fools use no tools" >with a french proverb which could translated as "one >recognize the good worker from its tools".

I like it!

Thanks again.

Alberto

P.S. I guess I am on the hook for doing the Italian translation :-).

Flat View: This topic has 20 replies on 2 pages [ « | 1  2 ]
Topic: The Way of Testivus - Unit Testing Wisdom From An Ancient Software Start-up Previous Topic   Next Topic Topic: Java: a Success Story Beyond JavaOne 2007

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use