On 4/3/07, Abdul Qayyum <[EMAIL PROTECTED]> wrote:
---------- Forwarded message ----------
From: Abdul Qayyum <[EMAIL PROTECTED]>
Date: Apr 4, 2007 10:47 AM
Subject: RE:[appfuse-issues] test classes are not tested and test-service
results in suc
To: [EMAIL PROTECTED]
>In the future, please ask these types of questions on the user list.
Yes sure.
Thanks for your reply
I am extreamely sorry I misspelled the package name in the directory
structure in the mail that I wrote you earlier.
My package name inside "test" package is "service" only. I am very sorry for
that blunder.
I was thinking that the second target "compile-service" compiles the actual
service package and not the test service package.
But your reply says it does compile service package of test package.
It compiles all files in the "service" directory - in both "src" and "test".
I was rather more concern aboput the the following lines of my code
<propertycopy name="testcase" from="@{module}-testcase"
silent="true"/>
What does "-testcase" has to do in the above code.
I'm not sure, but it works! Here's an explanation of what propertycopy does:
http://ant-contrib.sourceforge.net/tasks/tasks/propertycopy.html
I am writing the ant script for the first time, so I am a bit confused with
it. Please tell me if I am doing any thing wrong.
I'd recommend picking up a copy of Java Development with Ant:
http://www.manning.com/hatcher/
Much of AppFuse's build.xml is based on this book.
Matt
I have attached my ant file with this mail for convinience.
Thanks in advance
> </copy>
On 4/3/07, Matt Raible <[EMAIL PROTECTED]
> wrote:
>
>
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>
In the future, please ask these types of questions on the user list.
Matt
On 4/3/07, Abdul Qayyum <
[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 -->trunck
> --> actions
> com -->trunck -->trunck -->trunck -->trunck
> --> actionforms
> com -->trunck -->trunck -->trunck -->trunck
> --> services
> com -->trunck -->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]