I'm just reviewing what major changes I am needing to do to my (big) work project to simplify stuff. One troublespot is running functional tests against a running system, I need to (maybe) start a program, run tests against it and then stop the program if I started it (but not if it was already running under a debugger or something). what we have today is nasty and brittle.

I have to start something in parallel, wait by polling a port for a signal that it is running, then run the tests, finally shut it down if we started it (broken).

<target name="system-tests" depends="parse,dist,compile-tests,init-codebase"
    description="run system tests"
    if="system.tests.enabled">
    <parallel>

      <!-- first thread runs the daemon -->
      <sequential>
        <antcall target="start-daemon-if-needed"/>
      </sequential>

      <!-- this is the next thread -->
      <sequential>

        <!--
          wait ten seconds for the harness to start
          without this the first tests will fail as there is no
          sf daemon around
        -->
        <sf-waitfordaemon maxwait="10" timeoutproperty="daemon.missing"/>
        <fail if="daemon.missing">No daemon</fail>
        <sf-junit
          errorProperty="test.failed"
          failureProperty="test.failed"
          >
          <classpath>
            <path refid="tests.run.classpath"/>
            <pathelement location="${test.classes.dir}"/>
          </classpath>
          <sysproperty key="org.smartfrog.codebase" value="${codebase}"/>
          <syspropertyset>
            <propertyref prefix="runtime"/>
          </syspropertyset>

          <!-- #Test case isolation technique -->
          <test name="${testcase}" if="testcase"/>
          <batchtest todir="${test.data.dir}" unless="testcase">
            <!-- bulk test case -->
            <fileset dir="${test.classes.dir}">
<include name="org/smartfrog/services/junit/test/*Test.class"/>
            </fileset>
          </batchtest>
        </sf-junit>

        <!-- conditionally stop the daemon -->
        <antcall target="conditional-daemon-exit"/>
        <!-- end the test thread -->
      </sequential>
    </parallel>
  </target>


Life would be simpler if I could exec something in the background. Not spawned, which is designed to outlive ant, just in the background. stopping ant would stop background stuff. output would still go to the logger.

I would also like to be able to kill a background process by name, a name I assigned it earlier. My testing would then be

<java ... background="server" />

<junit ... />

<killbackground name="server" />

Nice and simple to use. To implement? I dont know, yet.

What do people think?

-steve


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

Reply via email to