TestNG MixedMode

Revision as of 15:09, 6 February 2012 by Jungi (Talk | contribs)

Contents

Motivation

TestNG is getting more and more interest from developers due to its specific features which are missing in JUnit, such as ability to define dependencies between tests, define test groups, have parametrized test, parallel test execution and many others. It also provides a way to run JUnit tests. But as of version 6.3.1 this feature is limited only to JUnit 3 tests [read more] and even tough there are already tools helping developers to migrate from JUnit to TestNG the migration from JUnit to TestNG can be a bit painful and time consuming. Not mentioning that TestNG itself does not provide any no tool which would help in migrating JUnit 4 tests to TestNG.

Solution

The idea is instead of providing a JUnit test 3/4 conversion tool to improve TestNG itself so it can automaticaly recognize JUnit 3 and JUnit 4 tests and run them if a user asks TestNG to do so and puts JUnit library on TestNG's classpath.

This is achieved through new TestNG parameter called -mixed. This parameter tells TestNG that it should also check files passed to it for presence of JUnit tests - be it a JUnit 3 test with suite method or a TestCase with test* methods or JUnit 4 test annotated with org.junit.TestNG annotation. The only requirement here is that TestNG is able to find JUnit on its test classpath.

Known issues

ChangeLog

This part discribes all differences between official TestNG distribution (as of v. 6.3.2beta from January 10, 2012) and modified TestNG library included as part of TestNG plugin for NetBeans

  • ad72beb - unrelated - a fix for building TestNG distribution to contain additional artifacts in a common location
  • 89f3b06 - update JUnit library used for building TestNG to JUnit 4 and support for running JUnit 4 tests
  • f5c4b35 - provide two versions of testng.jar - one with rebundled JUnit classes and second without JUnit classes
  • 1522307 - fixing compilation errors after pulling from official repository
  • 71126c8 - initial checking of mixed mode
  • f258209 - separation of JUnit3 and JUnit4 runners and improved test results reporting
  • 1876355 - previous 2 changesets (71126c8 and f258209) merged into one for better review
  • bf04c20 - (empty) merge
  • 543fc9c - a typo
  • 77de21b - making sure that TestNG runs with JUnit on its classpath as well as without it without any errors
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo