Sebb

Thank you so much for your time!

Maybe the last_sample_ok issue was confusing me, but I've now got
something to work with.

Adam

On 27 January 2011 17:19, sebb <[email protected]> wrote:
> On 27 January 2011 16:49, Adam Ploverall <[email protected]> 
> wrote:
>> Sebb
>>
>> Thank you for your perceptive answer.  Yes, I was wrong to say the
>> BEAN SHELL ASSERTION script was being skipped.
>>
>> I have:
>>
>> Thread Group (1/0/1)
>> + HTTP Cache Manager (clear cache)
>> + HTTP Cookie Manager (clear cookies)
>> + Simple Controller
>> ++ HTTP Request
>> +++HTTP Header Manager (host, accept, useragent, etc)
>> ++Bean Shell Assertion
>> ++ Assertion Results
>> + View Results Tree
>> + Mailer Visualizer
>>
>> The BEAN SHELL ASSERTION now contains only:
>>
>>   print("Start of script 27b");
>>   print(vars.get("JMeterThread.last_sample_ok"));
>>   print( ResponseCode);
>>
>> With a valid tested server port:
>>
>>  Start of script 27b
>>  true
>>  200
>
> OK
>
>> and we have success.
>>
>> When changing the HTTP request to an invalid port (just to fake the test):
>>
>>  Start of script 27b
>>  true
>>  Non HTTP response code: java.net.SocketTimeoutException
>
> That may be a bug - not sure why last_sample_ok is true here.
> [Also the response code should probably be numeric]
>
>> and the Mailer Visualizer sees an error (failure).  The sampler result is:
>
> That's because SampleResult.isSuccessful() is false
>
>>
>>   Thread Name: *************
>>   Sample Start: 2012-04-08 03:40:54 BST
>>   Load time: 5005
>>   Latency: 0
>>   Size in bytes: 1577
>>   Sample Count: 1
>>   Error Count: 1
>>   Response code: Non HTTP response code: java.net.SocketTimeoutException
>>   Response message: Non HTTP response message: connect timed out
>>
>>  Response headers:
>>
>>   HTTPSampleResult fields:
>>   ContentType:
>>   DataEncoding: null
>>
>> So, I suppose my simpler question is, how would I conditionally branch
>> on the HTTP Request sampler error, and only do other assertion tests
>> and email if a non null status code is returned?  I'm happy to do this
>> in the Bean Shell script, if it isn't possible with the standard
>> Jmeter components.
>
> This boils down to how to distinguish the different HTTP sample results.
>
> SInce last_sample_ok is not being set (I think that's a bug), just
> check SampleResult.isSuccessful() instead.
>
> For example,
>
> vars.put("OK",String.valueOf(SampleResult.isSuccessful()));
>
> ...
>
> If Condition = ${OK}, Interpret Condition as Variable Expression? = true
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to