Hi Steve,
Thanks for the reply.
My doubt was like, if we call two java tasks inside parallel task will it be started in same
jvm, where we started ant, or each task will be started in separate jvm.
Lokesh.
P.S.Lokesh wrote:
hi,
I have been looking through the docs to run my junit tests in the same
jvm where server is started, but i could not achieve it through parallel
task,
No, you cant, it doesnt make sense.
shown below is the sample code:
<target name="startserver" description="Starting Server">
<parallel>
<exec dir="/producthome/bin" executable="/bin/sh" os="Linux">
* <!-- I expect all the unit tests to happen in this jvm
where start server starts a main java class -->*
<arg line="startserver.sh"/>
</exec>
This execs a shell script. Ant knows the process ID, but does not know
or care that it is a server
<sequential>
<sleep seconds="30"/>
fairly crude synchronisation. I'd use <wait> with a condition like a
port or HTTP page being present.
<mkdir dir="${target.report.dir}/html"/>
* <!-- But I thik this task starts a separate jvm and
hence my results fails -->*
<junit printsummary="withOutAndErr"
showoutput="true" forkmode="once">
<classpath path="${clp}"/>
<batchtest todir="${target.report.dir}">
<fileset dir="${classes.dir}">
<include
name="**/Test*.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
</junit>
Here's the problem.
1. Ant doesnt know that you started a JVM up above
2. Even if it did, it wouldnt be able to start junit in that JVM,
because that JVM is off running a service.
How do i achieve this ? Is there any other way to do this ?
1. Jakarta Cactus, http://jakarta.apache.org/cactus/
This hosts Junit tests inside an application server.
2. Smartfrog JUnit deployment http://smartfrog.org/
This is something I have yet to finish, but which will let you deploy
junit tests just like any other bit of a distributed system. If you
deploy the junit tests into the same process as the application server,
then you *may* get what you want. However, it is more complex as you
need to switch to smartfrog to describe how to deploy something, and to
declare the test running workflow (i.e. which machine/process to collect
results).
-steve
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]