You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Joe Kramer <cc...@gmail.com> on 2006/12/19 10:21:07 UTC

Jmeter with ant: can't fail the build.

Hello,

I can't get Jmeter to fail Ant build in event of failed Jmeter tests.
I already wrote to Jmeter-ant developer but no reply.

I am running the jmeter task with deliberately incorrect parameters,
and build returns "SUCCESS":

    <target name="test"  description="--> Jmeter Tests" >
    	<property name="test.fail" value="false"/>
    	<jmeter
    		failureProperty="test.fail"
    	    jmeterhome="${jmeter.home}"
    	    resultlog="./log/JMeterResults.jtl">
    		<testplans dir="./jmeter/" includes="*.jmx" />
    		<property name="request.threads" value="1"/>
    		<property name="request.loop" value="1"/>
    		<property name="HTTPSampler.domain" value="nonexistent"/>
    	</jmeter>
    	<echo >test fail: ${test.fail}</echo>
		<fail message="Tests failed">
			<condition>
				<istrue value="${test.fail}"/>
			</condition>
		</fail>
    </target>


Output is:
test:
   [jmeter] Executing test plan: /jmeter/Test1.jmx
   [jmeter] Created the tree successfully
   [jmeter] Starting the test
   [jmeter] Tidying up ...
   [jmeter] ... end of run
     [echo] test fail: false
BUILD SUCCESSFUL

Jmeter log show that test failed:
1166459094546,14,Request root,Non HTTP response code,Non HTTP response
message,Thread Group 1-1,text,false
1166459689209,14,Request root,Non HTTP response code,Non HTTP response
message,Thread Group 1-1,text,false

What am I doing wrong?
If it's not possible with jmeter ant task, then how do you run Jmeter
from Ant using exec properly and capture failure/success?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Jmeter with ant: can't fail the build.

Posted by sebb <se...@gmail.com>.
On 19/12/06, Joe Kramer <cc...@gmail.com> wrote:
> Hello,
>
> I can't get Jmeter to fail Ant build in event of failed Jmeter tests.
> I already wrote to Jmeter-ant developer but no reply.
>
> I am running the jmeter task with deliberately incorrect parameters,
> and build returns "SUCCESS":
>
>    <target name="test"  description="--> Jmeter Tests" >
>        <property name="test.fail" value="false"/>
>        <jmeter
>                failureProperty="test.fail"
>            jmeterhome="${jmeter.home}"
>            resultlog="./log/JMeterResults.jtl">
>                <testplans dir="./jmeter/" includes="*.jmx" />
>                <property name="request.threads" value="1"/>
>                <property name="request.loop" value="1"/>
>                <property name="HTTPSampler.domain" value="nonexistent"/>
>        </jmeter>
>        <echo >test fail: ${test.fail}</echo>
>                <fail message="Tests failed">
>                        <condition>
>                                <istrue value="${test.fail}"/>
>                        </condition>
>                </fail>
>    </target>
>
>
> Output is:
> test:
>   [jmeter] Executing test plan: /jmeter/Test1.jmx
>   [jmeter] Created the tree successfully
>   [jmeter] Starting the test
>   [jmeter] Tidying up ...
>   [jmeter] ... end of run
>     [echo] test fail: false

So the JMeter Ant task did not regard the test as failed.

> BUILD SUCCESSFUL
>
> Jmeter log show that test failed:
> 1166459094546,14,Request root,Non HTTP response code,Non HTTP response
> message,Thread Group 1-1,text,false
> 1166459689209,14,Request root,Non HTTP response code,Non HTTP response
> message,Thread Group 1-1,text,false
>
> What am I doing wrong?

Probably nothing.

> If it's not possible with jmeter ant task, then how do you run Jmeter
> from Ant using exec properly and capture failure/success?

I've rarely used the JMeter Ant task, and I don't know if it is
supposed to support this or not.

I doubt that running JMeter via exec would help.

Have you checked if JMeter returns a different status when there has
been a failure? I'm fairly sure that JMeter always returns the same
status code.

You might find that Ant can scan the log file to look for a failure
indication and use that. Check the Ant documentation.

> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org