DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > One Click Test Conversions

One Click Test Conversions

Cedric Beust user avatar by
Cedric Beust
·
Jan. 05, 11 · Java Zone · Interview
Like (0)
Save
Tweet
6.78K Views

Join the DZone community and get the full member experience.

Join For Free

if converting your tests to testng is one of your new year’s resolution, you are in luck. introducing the improved junit to testng converter.

a couple of months ago, i gave a preview of the new features in the testng eclipse plug-in and i observed that more and more people were converting their tests from junit 3 and junit 4 to testng. this latter was a surprise to me since i never really expected anyone would want to move away from junit 4 once they have migrated to it.

testng has long supported individual class conversions in the form of quick fixes:

i recently expanded this support and turned it into a full refactoring, which means that you can now apply it to entire packages, source folders or even projects.

to use it, install the latest testng eclipse plug-in , open your package explorer and right click on either a package, a source folder or a project:

the refactoring wizard contains two pages.

the first one lets you customize the testng.xml that’s about to be generated (you can also choose not to generate one):

the next page shows you a view with all the changes that are about to be made to your source files. these changes are similar to the ones made with the quick fix except that they now apply to multiple files:

on this page, you can exclude certain files from being converted, and when you’re happy, press the finish button.

like all refactorings in eclipse, you can undo your changes in one click if you change your mind:

in a next post, i’ll show how you can use this new functionality to help you check that your unit tests are as isolated as you think they are.

now go ahead and convert your tests, that’s one less new year’s resolution you have to worry about!

from http://beust.com/weblog/2011/01/04/one-click-test-conversions

unit test

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Modern Application Security Requires Defense in Depth
  • Caching Across Layers in Software Architecture
  • Monolith vs Microservices Architecture: To Split or Not to Split?
  • Major PostgreSQL Features You Should Know About

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo