The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)


[SOLVED] sahi ant task - Connection refused

i created a sahi ant task to run a test suite:
<target name="runSahiTests">
    <antcall target="start-web" />
    <antcall target="runSahi" />
    <antcall target="stop-web" />

<target name="start-web" description="starts web">
    <exec executable="../testing/sahi/userdata/bin/" osfamily="unix" spawn="true"/>

<target name="stop-web" description="stop web server">
    <get dest="stopserver.htm" src="http://localhost:9999/dyn/stopserver" ignoreerrors="true" />
    <delete file="stopserver.htm"/>

<taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="../testing/sahi/lib/ant-sahi.jar" />
<target name="failsahi" if="sahi.failed">
    <fail message="Sahi tests failed!" />
<target name="runSahi">
    <sahi suite="/home/me/workspace/myApp/testing/functional_testing/stage_1/sahi/smoketest.suite"
        <report type="html" />
        <report type="junit" logdir="/home/me/workspace/myApp/testing/sahi/userdata/temp/junit" />
    <antcall target="failsahi" />

but when i ran it i would get the following error:
[sahi] Connection refused
[sahi]     at Method)

to fix this i inserted a sleep call in the start-web target:
<target name="start-web" description="starts web">
    <exec executable="../testing/sahi/userdata/bin/" osfamily="unix" spawn="true"/>

    <sleep seconds="5"/>

to give the sahi proxy server enough time to start up beforing running the sahi task.

i also noticed that red paths above had to be fully qualified paths instead of relative paths, otherwise the sahi task would start, but it would never do anything and i would have to kill it in order to stop it.

see also how to run sahi tests in ant build file using testrunner

No comments:

Post a Comment