JUnit Is Not Just For Unit Testing Anymore!

About Michael James

Michael James is a software process mentor, team coach, and Scrum Trainer with a focus on the engineering practices (TDD, refactoring, continuous integration, pair programming) that allow Agile project management practices. He is also a software developer (a recovering "software architect" who still loves good design).

  8 comments for “JUnit Is Not Just For Unit Testing Anymore!

  1. Carol Mirakove
    March 27, 2009 at 11:54 am

    i am a qa person and i am totally sold on junit and the benefits of continuous integration. however, you omit a key benefit of tools like silktest, winruuner, etc., which is that they support data-driven tests. this for qa is imperative. we need to test many permutations of an application event, not simply a few positive ones. for example, when working on an ecommerce site and testing a search engine, i want to script the invokation of the search function just once and make the input string a parameter, where that parameter is fed by an external data file that can contain a large number of test strings. we need to test way more than one or a few positive test cases, and data-driven testing allows us to do this. you have mentioned to me, michael, that we should look into FIT for this purpose, and i will, i just want to call out that for qa people this is a critical piece of the puzzle.

  2. Michael James
    March 27, 2009 at 11:54 am

    Carol’s message illustrates the value of involving QA from the very beginning. An isolated programmer in a hurry to get “code complete” is less likely to think of the negative test cases necessary to get work done/done/done.

    While many JUnit teaching examples focus on the positive cases (what we used to call the “happy path” or “main success scenario” back in the days of use cases) it’s just as applicable for testing error handling.

    I’ll be running a webinar on how to do this in the near future.

    Michael James
    Software Process Consultant
    http://www.danube.com

  3. Anonymous
    March 27, 2009 at 11:54 am

    Beginners may find more on jUnit and Unit Testing in the following article:

    Unit Testing 101

  4. Anonymous
    March 27, 2009 at 11:55 am

    Beginners may find more on jUnit and Unit Testing in the following article:

    http://weblogs.java.net/blog/cayhorstmann/archive/2006/10/the_worlds_simp.html

  5. Michael James
    March 27, 2009 at 11:56 am

    I applaud that professor for teaching automated testing (which should be an integrated part of programming) in his programming course. I’d be a bit wary of continuing the System.out.println() approach beyond one course though. JUnit’s not too hard to learn, especially compared to learning to code.

    –mj

    Michael James
    Software Process Consultant
    http://www.danube.com

  6. March 27, 2009 at 11:56 am

    Just a quick comment about data driven tests with watij or other tools.

    Since watij is a java api you are free to construct any type of testing framework. You can model your automation framework to mirror your applications model and build test cases which are also data driven. It would not be difficult to build a test case which pulls data from a file or internal data structure to execute a test multiple times with varying data scenarios.

    For a simple example: I could model a Login with a LoginTest class which uses a User object to login and validate on login. You could then create multiple scenarios for LoginTest by just creating new User objects with varying scenarios and validate expectations.

    I am hoping to cover some of this at my talk at Agile 2007 this year.

    Happy Testing

    Jake Dempsey
    http://www.watij.com
    http://www.explainpmt.com

  7. Michael James
    March 27, 2009 at 11:56 am

    Your point illustrates there’s a lot to be said for writing the tests in a programming language like Java, which lets you do *anything*, rather than a proprietary scripting language which seems easier to learn at first but is ultimately more limiting.

    Congrats on the 3.1.0 release of a great tool, and give a great talk at Agile 2007.

    –mj

    Michael James
    Software Process Consultant
    http://www.danube.com

  8. Derrek Wood
    March 27, 2009 at 11:56 am

    nice topic, testing is always a major hurdle to get ‘leet’ programmers to become business useful.

    http://www.junitee.org/ seems missing from your list though. Cactus does the same, but the core JunitEE code is nice if you want to integrate the test code right into the program environment and get away from unit testing. (free too)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

CAPTCHA Image

*