I just finished implementing the new annotations. The code is checked in, all the examples have been ported to the new notation and they all pass. I preserved the older tests in a v4/ directory, so a full build of TestNG now tests the following:That's a lot of testing...
- JavaDoc annotations with JDK1.4
- Annotations with JDK 5
- JavaDoc annotations with JDK 5
- v4 JavaDoc annotations with JDK1.4
- v4 Annotations with JDK 5
- v4 JavaDoc annotations with JDK 5
Here is what the new hotness looks like:
@BeforeSuite, @AfterSuite, @BeforeTest, @AfterTest, @BeforeGroups, @AfterGroups, @BeforeClass, @AfterClass, @BeforeMethod, @AfterMethod
@testng.before-suite, after-suite, before-test, after-test, before-groups, after-groups, before-class, after-class, before-method, after-method
I hesitated for a while between @BeforeMethod and @Before (like JUnit 4 does), and I opted for the former because @Before is too vague in my opinion.
If you think we should try to be more compatible with JUnit4, let me know and we can always change it.
./alex
--
.w( the_mindstorm )p.
On 6/23/06, Cédric Beust ♔ <cbe...@google.com> wrote:
Looking at and comparing with JUnit is per se no a bad thing. I agree
with you, that TestNg is a great testing framework, and I also agree
that @BeforeMethod is more expressiv than just @Before.
All I want to say is that JUnit is the de-facto standard and many,
many projects are out there which use JUnit. People starting with
TestNG will most likely come from JUnit and why not making the
transition as smooth as possible. And then there are situations where
both frameworks are used in paralell, like in the company I am working
with. I often switch between JUnit and TestNG tests.
The beauty of JUnit I think lies in its simplicity. TestNG is more
like a Swiss knife, very powerfull and ready for many different
situations. But sometimes it is a little bit difficult to get out the
right one. For a Swiss knife you need good and strong fingernails,
for TestNG with so many configurations options you need a great
memory.
Don't be too hard on JUnit.
Andreas
On 6/23/06, Eran <era...@gmail.com> wrote:
> On 6/23/06, Cédric Beust ♔ <cbe...@google.com > wrote:
> > I hesitated for a while between @BeforeMethod and @Before (like JUnit 4
> does), and I opted for the former because @Before is too vague in my
> opinion.
>
... and imo this is a good reason to have TestNG special annotations. You will be able to use both
without having to use fqn-s ;-).
./alex
--
.w( the_mindstorm )p.
And then there are situations where
Andreas
I agree.
I don't understand the argument for choosing similar annotations as
JUnit, beyond the psychological one. It'd be like choosing to have a
TestCase class, because that's what JUnit does. It still wouldn't
work as expected (it'd be in another package, so you can't be
framework independent), and all it does is cause confusion (oh, I
have both in my classpath, and I accidentally imported the wrong
one). Besides, as Cedric i think pointed, in typical JUnit fashion,
@Before is too simplistic and assuming. The JUnit people don't seem
to have quite figured out what others who use annotations regularly
already have, namely that they need to be more descriptive than
regular classes, since you hardly ever seen the package in the
annotation.
Of course, if one were to apply that same rule to tng's annotations,
we'd be forced to admit that @Configuration is an equally bad name,
and should have instead been @TestConfiguration ;)
JUnit, beyond the psychological one. It'd be like choosing to have a
TestCase class, because that's what JUnit does. It still wouldn't
work as expected (it'd be in another package, so you can't be
framework independent), and all it does is cause confusion (oh, I