Ant 서버가 백그라운드 서버 데몬을 스핀 업하도록하여 서버와의 통신이 필요한 클라이언트에 대해 테스트를 작성할 수 있는지 궁금합니다. 그래서 같은 자바 작업 생성을 시도했다 :Ant가 junit 테스트를 위해 백그라운드 프로세스를 시작합니다.
<java classpath="${jar.dir}/foo.jar" classname="foo.Server" fork="true" failonerror="true">
<arg value="7777"/>
</java>
제대로 서버를 회전
하지만, 블록을 무기한. 내가 spawn="true"
를 추가 할 경우,이 얻을 :
spawn does not allow attributes related to input, output, error, result
spawn also does not allow timeout
finally, spawn is not compatible with a nested I/O <redirector>
나는이 인수로 인해 가정 만이 서버에 필요한 그리고 나는 그것을 극복하는 방법을 모르겠어요.
<target name="junit" depends="build-jar">
<mkdir dir="${report.dir}"/>
<junit printsummary="yes">
<classpath>
<path refid="junitcp"/>
</classpath>
<formatter type="brief"/>
<batchtest fork="yes" todir="${report.dir}">
<fileset dir="${homeDir}" includes="foo/*Test.java"/>
</batchtest>
</junit>
</target>
junit 테스트에서 직접 서버를 시작/중지해야합니다. 그런 식으로 개미 또는 테스트 진행을위한 다른 프로세스에 의존하지 않아도됩니다. – oers