Thank you for checking these, and updating the thread for everyone's
future reference.

Adam

On 27 January 2011 17:36, sebb <[email protected]> wrote:
> 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.
>
> Just realised that this is because the variable is only set once all
> the Assertions have been run, as it depends on the Assertions.
>
> So the variable is not accurate whilst assertions are being processed,
> nor PostProcessors since they run before Assertions.
>
> You could use a Listener instead and the variable will be OK then.
>
>> [Also the response code should probably be numeric]
>
> Also not true...
>
>>> 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
>
> Not a bug - see above.
>
>> 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