On 23 May 2014 12:48, <[email protected]> wrote:
> Hi Sebb,
>
> Yes, I have tried it.
>
> I'll still get response messages of "OK" to the console. Which I assume
> is thread race conditions.
No, it's not a JMeter bug.
The Beanshell code is wrong - the response code is a string, not a
number, so the code should be:
if (!"200".equals(prev.getResponseCode())) {
print(prev.getResponseMessage());
}
If in doubt, add an else clause or some more debug and it would have
been obvious that the condition was not behaving as expected.
> Paul
>
> On Fri, 23 May 2014, at 04:33 AM, sebb wrote:
>> On 23 May 2014 11:31, <[email protected]> wrote:
>> > Hi,
>> >
>> > I would like to log responses for non-200 HTTP status codes.
>> >
>> > In the Beanshell post-processor I have the code:
>> >
>> > if (prev.getResponseCode() != 200) {
>> > print(prev.getResponseMessage());
>> > }
>> >
>> > But this is not going to work, because 'prev' is global and the state
>> > can mutate within the conditional.
>>
>> Are you sure it does not work?
>> Have you tried it?
>>
>> > Could you tell me what the best approach would be to log non-200
>> > response messages or errors?
>>
>> I would probably use a Listener, but I don't immediately see why the
>> Post-Processor approach should not also work.
>>
>> > Thanks
>> >
>> > Paul
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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]
>>
>
> ---------------------------------------------------------------------
> 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]