Did you try the suggestion I originally posted to this question on the
issues list?

Adding an "s" on the following two calls to macros should help:

<target name="test-services" depends="compile-service,check-debug"
description="Test service module">
      <test-module module="service" />
  </target>

<target name="compile-service" depends="compile-dao"
description="compile service module">
<compile module="service"/>
   </target>

Proposed fix:

<target name="test-services" depends="compile-service,check-debug"
description="Test service module">
      <test-module module="services" />
  </target>

<target name="compile-service" depends="compile-dao"
description="compile service module">
<compile module="services"/>
   </target>

Matt

On 4/3/07, Md Quayum <[EMAIL PROTECTED]> wrote:
Dear Group members,
I am using struts-spring-hibernate technologies in my application.
The application is completed and running. We want to write test cases for our
application. So, we have decided to use appfuse.
  Our directory-structure is slightly different from appfuse 1.9 (since we are
using appfuse 1.9 )

Neverthless, I have configured the ant script in my application corresponding
to running tests in accordance with that of appfuse. Now what I the script is
not compiling the test classes before testing and the result is always
 successful.
For example if I change the test class to assureNotNull on a null object, the
test does not through exception.

 Here is my script for testing service module:

<target name="test-services" depends="compile-service,check-debug"
description="Test service module">
        <test-module module="service" />
    </target>

<target name="compile-service" depends="compile-dao" description="compile
service module">
<compile module="service"/>
     </target>

<macrodef name="compile">
        <attribute name="module"/>
        <attribute name="additional.src.dirs" default=""/>
        <element name="options" optional="yes"/>

        <sequential>
            <echo>Compiling @{module}...</echo>
            <mkdir dir="${hrclasses.dir}"/>

            <javac srcdir="${src.dir}/@{module};@{additional.src.dirs}"
                destdir="${hrclasses.dir}" debug="${compile.debug}"
                deprecation="${compile.deprecation}" 
optimize="${compile.optimize}"
                classpathref="@{module}.compile.classpath">
                <options/>
            </javac>

        </sequential>
    </macrodef>

        <macrodef name="test-module">
                <attribute name="module"/>
                <attribute name="additional.src.dirs" default=""/>
                <element name="options" optional="yes"/>

                <sequential>
                    <echo level="info">Testing @{module}...</echo>
                    <mkdir dir="${test.dir}/data"/>
                        <propertycopy name="testcase" from="@{module}-testcase"
  silent="true"/>
                        <!-- Replace tokens in test properties files -->
                    <copy todir="${test.dir}/@{module}/classes">
                        <fileset dir="test/@{module}" excludes="**/*.java"/>
                        <filterset refid="variables.to.replace"/>
                    </copy>
                        <echo level="info">testing with junit...</echo>
                    <junit printsummary="yes" forkmode="once"
 errorProperty="test.failed"
                        failureProperty="test.failed" fork="${junit.fork}">
                        <classpath>
                            <pathelement path="@{additional.src.dirs}"/>
                            <path refid="@{module}.test.classpath"/>
                            <pathelement
 location="${build.dir}/@{module}/classes"/>
                            <pathelement
 location="${test.dir}/@{module}/classes"/>
                            <pathelement path="${java.class.path}"/>
                            <pathelement path="${webapp.target}"/>
                            <pathelement path="${build.dir}/dao/gen"/>
                            <!-- For .properties and .xml files -->
                            <pathelement path="${build.dir}/web/classes"/>
                            <pathelement path="src/@{module}"/>
                        </classpath>

                        <jvmarg line="${run.appfuse.test.debugargline}"/>
                        <formatter type="xml"/>
                        <formatter type="brief" usefile="false"/>
                        <batchtest todir="${test.dir}/data" if="testcase">
                            <fileset dir="${test.dir}/@{module}/classes">
                                <include name="**/*${testcase}*"/>
                                <exclude name="**/*TestCase.class"/>
                                <exclude name="**/*$*.class" />
                            </fileset>
                        </batchtest>
                        <batchtest todir="${test.dir}/data" unless="testcase">
                            <fileset dir="${test.dir}/@{module}/classes">
                                <include name="**/*Test.class*"/>
                                <exclude name="**/*$*.class" />
                            </fileset>
                        </batchtest>
                    </junit>

                    <fail if="test.failed">
                      Unit tests failed. For error messages, check the log
files in
                      ${test.dir}/data or run "ant test-reports"
                      to generate reports at ${test.dir}/reports.</fail>
                </sequential>
            </macrodef>


<!--    after configuring my eclipse to contain ant-contrib I have commented
 the below code
<macrodef name="propertycopy">
          <attribute name="name" />
          <attribute name="from"/>
          <sequential>
            <property name="@{name}" value="[EMAIL PROTECTED]"/>
          </sequential>
        </macrodef>      -->

MY DIRECTORY STRUCTURE is as follwos
trunck -->
            apps --> hr -->
                               com -->trunck -->trunck -->trunck --> actions
                               com -->trunck -->trunck -->trunck --> actionforms
                               com -->trunck -->trunck -->trunck --> services
                               com -->trunck -->trunck -->trunck --> dao
            test -->
                    services --> AddressManagerTest.java
                    dao --> ....java

that is I have created test directory in main directory.

Can any one please tell me where the script is actually looking for test
classes.
why appfuse do not compile test classes before testing that module.
am I doing anything wrong with the script. Am I missing any thing that is
 required for testing a module.

Thanks and Regards:
Md. Quayum Sagri


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to