July 19, 2006Announcing TestNG 5.0
A lot has gone into this release, and instead of boring you with a standard product announcement, I thought I'd try something new by giving you not only the list of the new features (at least the most important ones) but also a quick explanation why this feature was added. Read on, because this is no unusual product announcement! Let's start with a quick overview of the main TestNG 5.0 features:
Okay, I was just kidding about that last one. Just making sure you're paying attention. Let's go into details now. Configuration annotations In the early days of TestNG, the idea of an annotation that would indicate that a method has a special role was obvious to me. What was not obvious was: what should it be called? Believe it or not, I was already hesitating back then between @BeforeSuite and @Configuration(beforeSuite = true). That was two years ago. I could find virtues in either of these approaches, but I eventually opted for the latter because of IDE support. I thought that if all the configuration options can be gathered under one convenient annotation, it would be very easy for an IDE user to have a list of everything that's available: they can just type @Configuration(<ctrl-space> and they would get the full list. I still think this argument holds, but one can argue that it's equally easy to type @Before<ctrl-space> to get a list of all the "before types" that you can use. On top of that, the newer style has two extra benefits:
Of course, the old annotations are still recognized, but they are now deprecated. New report structure While TestNG lets you invoke multiple test suites easily (e.g. java org.testng.TestNG testng1.xml testng2.xml), the reports didn't maintain this distinction and bunched up all the results in the main output directory. I thought I would take advantage of this release to clean up this structure and have each suite create its reports in its own directory (named after the suite name). Additionally, the output directory now contains a single index.html that gives a composite view (and links) of all the suites that were run along with their outcome. Also, the reports are now using a CSS file and their appearance has been improved. They also contain additional information, such as a pointer to the testng.xml that was used for a particular suite. suiteName and testName These two attributes belong to the @Test annotation and they can be used as follows:
This feature will be of interest to users who don't want to use a testng.xml and, instead, prefer to use the command line or ant to invoke their test suite. With these two new attributes, these users can now get the benefit of seeing their test suites end up in a specific report. Of course, classes that use these attributes will have their reports generated in the structures as described in the previous paragraph. expectedExceptions This attribute used to have its own annotation (@ExpectedExceptions), but it was pointed to me that this annotation made little sense if it wasn't coupled with a @Test annotation, so this was definitely a design mistake that needed to be corrected. As of 5.0, @ExpectedExceptions is deprecated and you should now use the new expectedExceptions attribute from @Test:
Friendly stack traces This was another heavily-requested feature. Whenever a test fails, it does so with an AssertionException which shows the entire stack trace, including TestNG's internal frames, reflection, etc... These stack traces will now be hidden by default so that the report only shows what you really care about: Before:
After:
Finally, here is the complete TestNG 5.0 change log:
Posted by cedric at July 19, 2006 09:06 AM Comments
But why did you reduce the mana cost of Lightning bolt? Any why just 17%? Posted by: Matt at July 19, 2006 01:32 PMDamn, and I was hoping Shadow Bolt's mana cost would go down. Oh well, maybe TNG 6.0or in some other upcoming patch... Posted by: Hani Suleiman at July 19, 2006 01:35 PMNerf Shaman Posted by: at July 19, 2006 01:46 PMCedric, seems you miss @Test's expectedExceptions in TestNG documentation (http://testng.org/doc/documentation-main.html) Posted by: t800t8 at July 19, 2006 06:41 PMwill this work? Posted by: at July 19, 2006 10:55 PMand now, will *this* work? Posted by: x at July 19, 2006 10:56 PMwwww.call2biz .com How about launching your store on Cedric, Also you forgot to discard @ExpectedExceptions. Posted by: t880t8 at July 20, 2006 06:00 PMDid you really mean: "Read on, because this is no unusual product announcement!" ? Posted by: will ortiz at July 28, 2006 10:12 AM异型钢管 Posted by: 异型钢管 at August 10, 2006 10:14 PMPost a comment
|