TestNG revamped support for JUnit

I have spent a couple of hours this weekend on a new approach to running JUnit 3.x tests in TestNG

Previously, we have tried to emulate through TestNG the behavior of JUnit and things were quite complex. Also, considering how many extensions are there for JUnit we have never been sure we are able to run all existing JUnit tests.

So, I decided to give it another try and see if I can come out with a better approach. And instead of trying to emulate JUnit runtime behavior, I thought I can handle JUnit tests to JUnit itself and just make it report back the results. After a couple of hours of hacking I got it working and right now I think we will be able to run an even bigger percentage of existing JUnit code. And as a validation of the changes, I have run not only the TestNG tests (almost 300), but also JUnit internal tests (131) and all passed.

This new revamped support for JUnit will be released in the next version, but if you want to challenge it please feel free to build it yourself from the SVN trunk (or drop me an email) and put it to extensive work.

Advertisement

4 Comments

Filed under Uncategorized

4 responses to “TestNG revamped support for JUnit

  1. BK

    “I thought I can handle JUnit tests to JUnit itself and just make it report back the results.”>

    Alex:

    Thru ITestListener in TestNG, can Junit hack that you’ve done report back pass/fail as the test runs or you only gets a report after all tests have ran?.

    -BK-

  2. the_mindstorm

    Everything is “real-time” :-]. I mean JUnit reports back to TestNG in real time and TestNG triggers its events as normal.

    ./alex

    .w( the_mindstorm )p.

  3. BK

    Alex:

    Thanks. Will this be released in TestNG 5.2?

    thanks,
    -BK-

  4. the_mindstorm

    Yes, it is included with the TestNG 5.2 release.

    ./alex

    .w( the_mindstorm )p.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s