InfoQ

News

Interview and Book Excerpt: Hani Suleiman & Cedric Beust on TestNG

Posted by Scott Delap on Feb 14, 2008 03:44 PM

Community
Java
Topics
Software Testing,
Unit Testing
Tags
TestNG
InfoQ.com recently sat down with Hani Suleiman and Cédric Beust the authors of Next Generation Java Testing: TestNG and Advanced Concepts to discuss the book and their thoughts about testing in general. InfoQ is also pleased to offer an excerpt from chapter 2 of the book, "Mocks and Stubs".
Cedric:

TestNG started as an experimental toy project. The main motivation was that despite using JUnit for years, there were still a lot of concepts and approaches used by JUnit that I didn't feel comfortable with. The more I investigated, and the more I disagreed with some of its core philosophical design decisions, such as reinstantiating your class before each method invocation (thus forcing me to use statics if I want to maintain state between invocations) or not allowing me to create dependent tests, which are crucial for functional testing.

Overall, I just found that JUnit was doing great in the area of unit testing but was lacking in other places required by any kind of functional or acceptance testing.

Back then, I was also involved in the annotations JSR and it occurred to me that annotations would be a good fit to mark test methods.

Finally, the last piece in the puzzle came from a web site with the strange name of del.icio.us that introduced this bizarre new concept of "tags". It occurred to me that it would be neat if I could tag my test methods and then be able to invoke any arbitrary group of them without having to recompile anything. I renamed these tags "groups" and I realized that they would be a great match for annotations as well.

With these ideas in mind, I set out to create TestNG 1.0 almost four years ago and I published it just for fun and to get some feedback.

Read more of InfoQ's interview with Cedrick Beust and Hani Suleiman

3 comments

Reply

Free facials? by Michael Neale Posted Feb 14, 2008 8:10 PM
Mocks and Stubs by Pierre-Antoine Grégoire Posted Feb 15, 2008 3:33 AM
free chapter by serge boulay Posted Feb 15, 2008 4:43 PM
  1. Back to top

    Free facials?

    Feb 14, 2008 8:10 PM by Michael Neale

    For the first 100 copies sold? (sorry, couldn't resist).

  2. Back to top

    Mocks and Stubs

    Feb 15, 2008 3:33 AM by Pierre-Antoine Grégoire

    If you need to create Random Value Objects on the fly for your tests, consider Usurper http://www.org-libs.org/org-lib-usurper/ (Shameless self-publicity). This allows to generate a random User (for example) Value Object like this:

    UsurperGenerator<User> userGenerator = new UsurperGenerator<User>(User.class);
    //GENERATE ONE INSTANCE
    User user = userGenerator.generateUsurper();
    //GENERATE A LIST OF INSTANCES
    List<User> userList = userGenerator.generateUsurperList(3);
    
    There are many other features, like automatic stubbing of DAO methods. Check it out!

  3. Back to top

    free chapter

    Feb 15, 2008 4:43 PM by serge boulay

    I just read the free chapter, liked it so much that I decided to buy the book. Thanks

Exclusive Content

Rationalizing the Presentation Tier

Thin client paradigm characterized by web applications is a kludge that needs to be repudiated. Old compromises are no longer needed and it's time to move the presentation tier to where it belongs.

Agile Project Management: Lessons Learned at Google

In this presentation filmed during QCon 2007, Jeff Sutherland, the creator of Scrum, talks about his visit at Google to do an analysis of Google's first implementation of Scrum.

AtomServer – The Power of Publishing for Data Distribution

In this article, Bryon Jacob and Chris Berry introduce AtomServer, their implementation of a full-fledged Atom Store based on Apache Abdera, which is now available as open source.

An Introduction to Virtualization

It is easy to think that virtualization applies only to servers. In reality the recent resurgence of the concept is also being applied to networking, storage, and application infrastructure.

REST Anti-Patterns

In this article, Stefan Tilkov explains some of the most common anti-patterns found in applications that claim to follow a "RESTful" design and suggests ways to avoid them.

Choosing between Routing and Orchestration in an ESB

In this article, Adrien Louis and Marc Dutoo discuss the differences and relative merits of using orchestration vs. routing in a typical ESB setup, and discuss various implementation options.

Enterprise Batch Processing with Spring

Wayne Lund discusses batch processing, Spring Batch objectives and features, scenarios for usage, Spring Batch architecture, scaling, example code, failures and retrying, and the future roadmap.

User Story Estimation Techniques

Developer Jay Fields draws on his experiences as a ThoughtWorks consultant to describe effective user story estimation techniques.