TestNG Generator for IDEA

<1 min read
TestNG Generator is an IDEA plugin, based on Alex Nazimok's JUnit Generator. It is a very simple plugin that generates a TestNG test class skeleton for all of the current class methods. Alex did all the work. I just added a few things here and there. There's still more I'd like to do:
  • Add per-project configuration properties.
  • Make the newly created test classes noticed by the VC manager.
  • Incorporate it into Mark's TestNG-J .
TestNG Generator is currently available through the IDEA Plugins manager. The source archive can be found on the IntelliJ Community Wiki. As usual, the latest souce code is also in my public subversion repository. Constructive feedback welcome.

Comments

8 (Closed)

Manpreet Singh

Feb 24, 2006

I like unitTest plugin's ability to create tests individually and display an intention/hint in the sidebar for the ones that don't have a test. Something like this would be great for this and/or TestNG-J.

Thanks for creating this plugin. It already takes me halfway there!
Alexandru Popescu

Feb 24, 2006

Hi Eric!

This looks like a cool idea. I would like to ask you how is the generated class behaving in the following scenarios: original class method rename refactoring, original class rename refactoring, regeneration of the test class after read test code was added. I was always wondering how such a plugin should behave in these simple scenarios, but till now I haven't been able to come out with a good solution. Hopefully, you have the answers.

cheers,

./alex

--

.w( the_mindstorm )p.

TestNG co-founder
Erik C. Thauvin

Feb 24, 2006

Hey Alex!

Refactoring is an interesting notion when it comes to test methods/classes. IDEs are generally clueless when it comes to understanding the relationship between a method and its test method(s). But the relationship is not always obvious, even if you employ some sort of naming convention for all of your test methods. Something as simple as figuring out the name of the class and package could be daunting. Besides, there's not always a 1 to 1 connection between method and test method.

In other words, I don't think I have the perfect solution, unless you can come up with some kind of mechanism to identify the implied relationship whenever applicable.

E.
Alexandru Popescu

Feb 25, 2006

Hi Erik!

Unfortunately, it looks like we both have identified the same set of problems when speaking about refactorings. As I told you, I've been thinking about this (indeed sporadically) for a long time, and I don't think we can really do a good job. It would require to have some persistent metadata on test side that would link it to the original code. I've seen attempts to generate some special comments to keep this kind of metadata, but as you can imagine this is not immediately supported even by the most advanced IDE.

While speaking about persistent metadata, I have also thought about having a special annotation that would do this. Maybe we should further investigate this option and see if we can take something out of it ;-).

BR,

./alex

--

.w( the_mindstorm )p.

TestNG co-founder
Erik C. Thauvin

Feb 25, 2006

Hey Alex!

I haven't done a lot of thinking about this, but how about using a similar mechanism as the @see Javadoc tag:

/**

* @testng.test my.package.MyClass#myMethod(Object)

*/

Not quite sure how that would translate using the annotations syntax though.

E.
Alexandru Popescu

Feb 26, 2006

That's exactly what I've been thinking about. Maybe we should move this offline and get into some more details. You never know what may come out ;-). Please drop me an email and we can continue there.

cheers,

./alex

--

.w( the_mindstorm )p.
Falk Berger

Mar 2, 2009

Hi,

the plugin doesn't work with IDEA 8. Is an update planned?

Regards,

Falk
Erik C. Thauvin

Mar 2, 2009

I really don't have time to seriously look at it right now. There're a couple people who have indicated they would try to get it to work with IDEA 8, but I haven't seen anything concrete yet.

E.