InfoQ

News

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

Posted by Scott Delap on Feb 14, 2008

Community
Java
Topics
Unit Testing ,
Software 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

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

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.