The Artima Developer Community
Sponsored Link

Articles Forum
Next-Generation Testing with TestNG

4 replies on 1 page. Most recent reply: Dec 23, 2010 1:17 AM by Ruwan Harrison

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 4 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Next-Generation Testing with TestNG Posted: Aug 21, 2006 10:00 PM
Reply to this message Reply
Advertisement
In this article, Cédric Beust describes his biggest JUnit frustrations, and how he addressed them in TestNG. What JUnit limitations are you unhappy with? And what do you think of TestNG's way of solving them?


Kenneth Kasajian

Posts: 3
Nickname: kasajian
Registered: Aug, 2006

Re: Next-Generation Testing with TestNG Posted: Aug 26, 2006 8:47 PM
Reply to this message Reply
I stopped reading when the author basically says that what a lot of people consider to be unit-testing is not important, which is fine, but doesn't counter the other side's argument. I believe there is a benefit for making mock objects to improve speed. The author says it's not important, doesn't explain why other than the saying that he doesn't care.

That's about when I stopped reading.

Rossen Stoyanchev

Posts: 1
Nickname: rstoya05
Registered: Aug, 2006

Re: Next-Generation Testing with TestNG Posted: Aug 28, 2006 11:23 AM
Reply to this message Reply
TestNG creator Cédric Beust contradicts himself on one of his main points. First he says "Unit testing is an important part of testing..." but further down claims that "It's not." The point he makes here is that JUnit tests should be allowed to make database calls and mock objects should be avoided.

There is no argument here. JUnit does not preclude you from making database calls. In fact you should have both tests with database calls (integration testing) and tests using mock objects (logical unit testing). Each one of these serves a very different purpose. Vincent Massol covers this in good detail in his book "JUnit in Action". As for mock objects, beyond merely stubbing out expensive calls they can provide further benefits such testing interractions between the object under test and the classes it depends on.

There are also a number inaccurate statements throughout this interview that should be pointed out for readers. For example Cédric Beust implies there is no way to initialize expensive objects in JUnit once around test classes or suites. In fact this can be done with the TestSetup class in the JUnit framework.

As for not being able to swap tests in and out without recompiling that doesn't bother me. In the agile way of thinking all tests should run as often as possible, which is another reason to avoid expensive calls in logical unit testing.

Cedric Beust

Posts: 140
Nickname: cbeust
Registered: Feb, 2004

Re: Next-Generation Testing with TestNG Posted: Sep 1, 2006 9:25 AM
Reply to this message Reply
Thanks for the comments.

Yes, a few things didn't come the way I thought they would, sorry about that. Here are a few clarifications.

Unit tests are important but I don't care about the arbitrary limitations that some people claim, such as "never access the network" or "never use files".

Do whatever it takes to make sure your class works as expected, and most of the time, the running time won't suffer much and you'll get rapid feedback if something fails instead of having to rely on acceptance tests higher up the stack. Unless you want to run your tests every time you save a file, these times will not add up to enough to make a difference.

As for mocks, they come at a price (designing a parallel hierarchy with its own semantics and maintaining it) and I've seen enough abuse of them that I strongly caution against them now. In my opinion, there is only one good reason to use a mock: when the object under test is hard or costly to materialize in a testing environment.

Ruwan Harrison

Posts: 1
Nickname: ruwan
Registered: Dec, 2010

Re: Next-Generation Testing with TestNG Posted: Dec 23, 2010 1:17 AM
Reply to this message Reply
Hi All,

i'm actually doing QA and just want to see how i can use TestNG to do the functional and integration testing. Could i get some artifact regarding this if you have or could someone of you guide me in the regard.

Thanks,
Ruwan,

Flat View: This topic has 4 replies on 1 page
Topic: Azul's Pauseless Garbage Collector Previous Topic   Next Topic Topic: Where Do You Want to Be in Five Years?

Sponsored Links



Google
  Web Artima.com   

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