[Junitdoclet-users] first-day experiences with JUnitDoclet
Brought to you by:
sgemkow
From: Mike K. <mki...@al...> - 2003-10-10 15:46:42
|
I'm now using JUnitDoclet, and I thought I'd share how my first day with it went. I've summarized my setup issues in a previous message, but once it was installed, things went well! I was able to generate, and regenerate, test cases (strictly StrutsTestCases combined with DBUnit this first day so I can't yet comment on the default template or default test cases). The templating should really be improved. The old "line-edit" method of numbered lines in a property file is very painful in this "day and age" of full-screen editors. Fortunately, my years of experience on a vax mainframe with a dumb terminal gave me the necessary background to modify the template. In some ways, it's probably handy to have all of the templating in one file, but I'd prefer to see it broken out into separate files and using a real templating engine (such as Velocity Template Engine http://jakarta.apache.org/velocity/ ) so we can have a lot more control of automated test case generation. I'd also like to see the ability to have JUnitDoclet choose a template based on the Class superclass or the method signature, though. Currently, in order to support a separate Struts Action test case template, I have to group all of my Struts Actions in the same package so I can specify which template based on the package name. This goes against the idea than the test infrastructure shouldn't force changes to the application code layout. Ie, <target name="junitdoclet.noactions" description="Generate non-action test cases" depends="compile"> <javadoc packagenames = "com.gvea.*" excludepackagenames = "com.gvea.struts.ebpp.actions.*" additionalparam = "-buildall"> </javadoc> </target> <target name="junitdoclet.actions" description="Generate action test cases" depends="compile"> <javadoc packagenames = "com.gvea.struts.ebpp.actions.*" defaultexcludes = "yes" additionalparam = "-buildall -properties E:\Programming\Ebpp-struts\WEB- INF\src\support\JUnitDoclet\templates\action.junitdoclet.properties"> </javadoc> </target> All in all, JUnitDoclet works well once setup. I created 30 or so Struts action tests, discovered a few bugs in my code, and feel a lot better about the practicality of unit testing in general! I do have one question about testVault (which runs during a test). Is there a reason why it's named in such a way as to cause the code moved into testValue to execute during tests rather than being named "vault" or something else not tested? I'm gone for the weekend, but I'll be back Monday or Tuesday. I'd be willing to help change the templating mechanisms if there's an interest. -Mike |