IntelliJ Community . JUnitTestPlugin

 
JUnitTestPlugin 

HOME INDEX SEARCH CHANGES GO  

JUnit Test Plugin

Description

Plugin to make maintaining JUnit tests a little less painful.

Agile methodologies put a great emphasis on test automation. Kent Beck, one the father of XP, and Erich Gamma have written what is now the defacto framework for unit test automation, the XUnit framework family. It has been ported to many languages, its java incarnation being junit. The framework has many features that simplify the boring mechanics of testing: test case organization, set up, execution and result reporting. If you are not familiar with junit please read its cookbook. You also can find more on XP and unit testing here.

IDEA has a junit integration that simplify the testing process one step further:

  1. One click away run of one test method, all tests in one class, all tests in one package tree
  2. Navigation back to the source from assertion stack traces
  3. Keeps a list of test configuration for immediate rerun
  4. Aurora has now a much nicer graphical runner.

However there are several key area not covered that this plugin intends on addressing:

  1. Provide a way to define a project wide organization of test case with respect to the classes/methods they test
  2. Provide fast navigation between test element and tested element and vise-versa. This is even more important since IDEA does not have the ability yet to display tested element and test element side by side (multiple file editor splitting)
  3. Provide automatic creation of the test elements (Test class and methods) following customizable templates
  4. Keep in sync the names and location of test elements as the tested elements are renamed and moved.
  5. Provide visual feedback whether or not a method does not have test in the editor.
  6. Enhanced text ui to provide better visual feedback of test suite run status.
  7. Provide documentation on the Class Under Test from the test methods name

Disclaimer

This plugin uses an unsupported IDEA api, the ProgramStructureInterface. Since the PSI hasn't stabilize enough to be part of the OpenAPI, the plugin could be broken for any new build. Do not send bug report to the tracker. Just post to the plugins news group or email me if you have an urgent problem.
Please read the ProgramStructureInterface disclaimer.

Acknowledgements

Special thanks for Bronwen Cassidy who is helping a lot. She introduced the velocity template generation of the test class. Thanks for your passion to innovate and learn.

The current implementation of the plugin is based on MikeAizatsky's generous donation of his junit test plugin (see PsiIntroduction).

How to use

See JUnitTestPluginUserGuide

Installation

Download from the Attachements section the proper version of the plugin zip for your IDEA version and extract it to *IDEA_DIR/plugins*
Make sure that you have the following directory layout:

IDEA_DIR/plugins  
   unitTest
      lib
         unitTest.jar
         commons-lang-1.0.jar

History

0.27 (Aurora 4.0 - 4.5) Jun 09 2005

  • Version temporarily uploaded here for IDEA 4.0 - 4.5

0.25 (1131) Jan 30 2004

  • Fix incorrect identification of test class as class to be tested in multi-module projects

0.24 (1113) Jan 22 2004

  • Fix Test method with exception template
  • Fix toggle not working all the time => create new test class
  • Fix button to go from config to template editor

0.23 (992) Dec 09 2003

  • Upgraded to 992
  • Added validity check for patterns (reported by Thomas Svensen)

0.22 (977) Nov 15 2003

  • Upgraded to 977
  • Fixed dot in class name while the pattern is w/o $DIRECTORY$
  • Added method templates

0.21 (944) Oct 01 2003

  • Fix NPE in UntestedMethodHighligter? (reported by Michal Szklanowski)
  • Migrate to 944

0.20 (929) Sep 22 2003

  • Recompiled for 929 (fixed the broken auto-refactoring)
  • Fix the deadlock on second project load

0.19 (922) Sep 09 2003

  • Recompiled for 922

0.18 (915) Sep 05 2003

  • Fix NPE when loading second project
  • Fix wrong test class location if directory path contains '.' (Reported by M. J. Milicevic)
  • Fix icons in test template selection panel

0.17 (915) Sep 01 2003

  • Recompiled for 915
  • Fix creating test class in the wrong location when roots paths are overlapping (c:/src & c:/src-test, c:/src & c:/src/test) (reported by Chris Winters)

0.16 (896) Aug 18 2003

  • Add multiple test class template support. On Ctrl-Shit-T a choice of template to use will be presented (in place of the yes/no question)
  • Add option to bypass the template choise popup when there is only one test template
  • Fix to class creation problem (reported by Chris Winters)

0.15 (#876) Aug 5 2003

  • Fix template variable name of the test class (was CLASS_NAME and is now NAME like the normal IDEA class template)
  • Fix NPE on cancel of choosing the template used (reported by Bas Leijdekkers)
  • Fix "File Header" include not found if it isn't modified
  • Fix the changing of the test pattern only affecting the navigation and creation of test class/method and not untested method highlighting and auto-refactoring (reported by Bas Leijdekkers)
  • Change pattern $PACKAGE$ variable to $DIRECTORY$ to avoid confusion since this will match any directory whether it is a package or just a directory
  • Add template variables USER, DATE, TIME, TESTED_CLASS_NAME, TESTED_CLASS_PACKAGE_NAME

0.14 (#873) July 28 2003

  • Change settings to go to the workspace instead. This makes sharing the project file easier.
  • Add test class velocity template generation
  • Fix the intermittent assertion in isUnitTest() (reported by Bas Leijdekkers & Debabrata Dash)

0.13 (#833) - 22 June 2003

  • Upgraded to 833 (not backward compatible)
  • Gutter icons are now refreshed automatically as you type
  • Fixed NPE when editing Default Project properties

0.12 (#813) - 28 Apr 2003

  • Upgraded to 811 (not backward compatible)
  • Gutter icon is clickable which create/navigate to test method

0.11 (#811) - 11 Apr 2003

  • Upgraded to 811 (not backward compatible)
  • Fixed getter highlight options bug
  • Fixed renaming/moving test class refactoring. These refactorings won't change any references to the test classes (they do not use IDEA refactoring anymore due to an unsolvable problem). This is only a problem though when a static suite is used.

0.10 (#809) - 03 Apr 2003

  • Mark Untested methods with little red icon in the editor left gutter (Special thanks for BronwenCassidy to make it work)
  • NOTE: if you get a NPE while renaming/moving a class that seems unrelated to the plugin please turn off the automatic refactoring and see if it fixes the exception. If not restart IDEA. The next release will address this.

0.9 (#809) - 01 Apr 2003

  • Added automatic renaming of test methods if associated tested method is renamed.
  • Better help on patterns from the property panel

0.8 (#807) - 23 Mar 2003

  • Added automatic moving of test class if associated tested class is moved (through Move refactoring).
  • Fix bug preventing to rename any class w/o a test (Thanks DaveGriffith for reporting it)
  • Added support for test navigation in the Project and Structure tool window

0.7 (#802) - 16 Mar 2003

  • Added automatic renaming of test class if associated tested class is renamed (through Rename refactoring).

0.6 (#802) - 11 Mar 2003

0.5 (#802) - 08 Mar 2003

  • Migrate to Aurora
  • Added invitro tests to test the refactoring support
  • Added version number in the plugin properties panel
  • Beef up the build.xml and introduced a build.properties to customize paths

0.4 (#688) - 18 Dec 2002

  • Fix navigation to properly handle tested methods combination where one tested method name is completely included in another like myMethod in myMethodWithExtraWords
  • Fix bug that prevented a test method to be created when not found.

0.3 (#688) - 16 Dec 2002

  • Toggle does not move cursor if it is already inside target method
  • Recognize test methods with things after the tested method name like testMyMethodWithNullParam or testMyMethod_Success
  • Fix few bugs (structure popup menu item name, plugin properties pattern description)

0.2 (#674) - 08 Nov 2002

  • Set a default pattern ($CLASS%-> test/$CLASS% which is my prefered pattern wink )
  • Fix internal error on startup
  • Move the go to menu to the Go To top level menu and the editor popup Go to
  • Fix not firing a ModificationAttemptListener? when trying to create a test method on a readonly test class file (Should be done by PSI automatically IMHO). This allows other plugin a chance to make the file writable (ClearCasePlugin will offer to check out the file for example)
  • Fix missing import statement on newly create TestCase?

0.1 (#674) - 08 Nov 2002

  • Ctrl-T inside a method toggles between tested method and test method and vise-versa
  • Create test class and test method automatically
  • Supports a flexible test organization definition (See How To Use)

To Dos

See JUnitTestPluginRequests for the list of tasks. Please feel free to add your own and vote the existing ones.

Troubleshooting

You can turn the plugin debugging logging by modifying IDEA_DIR/bin/log.xml and append the following tags at the end:

  <category name="org.intellij.plugins.junit">
    <priority value="DEBUG"/>
    <appender-ref ref="CONSOLE-DEBUG"/>
    <appender-ref ref="FILE"/>
  </category>

The FILE appender will output the trace to the system log file located at $SYSTEM_DIR$/log/idea.log. $SYSTEM_DIR$ is on Win32 at C:\Documents and Settings\#USER_NAME#\.IntelliJIdea\system

-- JacquesMorel - 08 Nov 2002

IntelliJPluginWebForm
IntelliJPluginName: jUnitTestPlugin
IntelliJPluginVersion: 0.25
IntelliJPluginVendor: Jacques Morel
IntelliJPluginBinary: http://www.intellij.org/twiki/pub/Main/JUnitTestPlugin/unitTest.zip
IntelliJPluginSource: http://www.intellij.org/twiki/pub/Main/JUnitTestPlugin/unitTest-src.zip
IntelliJPluginClassification:
TopicClassification: IntelliJPluginPackage
TopicShortDescription: Plugin to make maintaining JUnit tests a little less painful.
TestedOnOS: OsWin2K, OsWinXP
ShouldRunOnOS: AnyOS

Attachment: sort Action: Size: Date: Who: Comment:
unitTest.zip action 310178 01 Jul 2004 - 09:20 JacquesMorel version 0.25 for IDEA Aurora 4.0
unitTest-src.zip action 1530548 31 Jan 2004 - 07:25 JacquesMorel 0.25 sources
unitTest696.zip action 133771 11 Mar 2003 - 12:59 JacquesMorel version 0.4 for IDEA 3.0
unitTest813.zip action 230572 02 May 2003 - 14:34 JacquesMorel version 0.12 for IDEA Aurora (#813)
unitTest701.zip action 134378 02 May 2003 - 14:37 JacquesMorel version 0.4.1 for IDEA 3.0.4
unitTest977.zip action 287517 11 Dec 2003 - 23:43 JacquesMorel version 0.22 for IDEA Aurora #977
unitTest4.zip action 1021432 09 Jun 2005 - 19:18 BronwenCassidy version 0.27 for IDEA Aurora 4.5
junit-test-plugin-22-12-06.zip action 13221277 22 Dec 2006 - 10:50 BronwenCassidy sources 22-12-06
unitTest-11-07-07-all.zip action 1309832 13 Jul 2007 - 21:38 BronwenCassidy improved version supporting idea version 4 - 6

e d i t a t t a c h r e f - b y d i f f s m o r e
Have ideas, requests, problems regarding this site? Send feedback.
Copyright © 2000-2003 by the contributing authors. All materials at intellij.org are the property of the contributing authors.