Help request to get Junit plugin to work...

"Gautam, Ajay, RBSGC" <[email protected]> Wed, 11 Jun 2008 17:45:15 -0400
Newsgroups gmane.comp.java.xdoclet-plugins
Message-ID <08BDE189142FEE458775B46F454B5E944F1978C66A@TRUPMAL0001.rbsres07.net>
Hello.

During my search for a tool to generate junit tests for rather mundane classes, I came across xdcolet2 and the junit plugin.

Unfortunately, I cannot get the plugin to work. Any help / pointers towards helping me getting the plugin to work (which I define as generate unit tests), would be greatly appreciated.

If I am mistaken as to what the plugin does, please do let me know.

Here is what I have done till now.

1. Download / setup xdcolet2 and plugins v.1.0.4


2. ant target:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    <!-- xdoclet for automated unit tests -->
    <property name="xdoclet.lib.dir" location="${test-lib.dir}/xdoclet2-1.0.4/lib"/>
    <target name="generate.junit.tests" description="--> description">
        <path id="xdoclet.task.classpath">
            <fileset dir="${xdoclet.lib.dir}">
                <include name="*.jar"/>
            </fileset>
        </path>

        <taskdef name="xdoclet" classname="org.xdoclet.ant.XDocletTask" classpathref="xdoclet.task.classpath"/>

        <xdoclet>
            <fileset dir="${src.dir}">
                <include name="**/*.java"/>
            </fileset>

            <component classname="org.xdoclet.plugin.junit.TestSuitePlugin" destdir="${build.dir}/xdoclet/"/>
        </xdoclet>
    </target>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


3. java code:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
package com.rbs.ird.cachemgr.data;

/**
 * @junit
 */
public class CurveKey  {
  private Long curveId;
  private String marketDataSetId;

  // constructors, getters, setters snipped

  @Override public int hashCode() {
        // snipped for readability
  }

  @Override public boolean equals(Object obj) {
        // snipped for readability
  }

}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


4. When I run the target, I get:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
gautaag@gpwws1206 cachemgr 17:11:10 $ ant generate.junit.tests
Buildfile: build.xml

generate.junit.tests:
  [xdoclet] Running org.xdoclet.plugin.junit.TestSuitePlugin
  [xdoclet] Unknown tag: @junit in file:/...../data/CurveKey.java (line 6)

BUILD SUCCESSFUL
Total time: 3 seconds
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


What I would like the plugin to do is to generate some form of automated test for getters, setters, hashcode and equals.

If I get this working, I would be happy to document my experience as a resource for the plugin.

Thanks

Ajay Gautam
(PS: Manifest file in plugin jar mentions "Built-By: ko5tik". Is ko5tik on this list?)

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php