You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by 75blured <75...@gmail.com> on 2008/07/24 09:33:49 UTC
Question about ResponseAssertion
Hello,
I've got a generic ResponseAssertion in my test case. This
ResponseAssertion say to check that there is no the word "Erreur" in the
HTML page.
Here is the content of ResponseAssertion (translated from french GUI to
english) :
ResponseFieldToTest : ResponseText
Rules corresponding to the pattern : Contains + Not
Pattern to test : Erreur
However when some requests success there is no text response return. So
those case are considered as error in JMetter which is not what I'd like
to have.
I'm looking to test :
if the Erreur word is present on html page --> consider that there is an
error
if the return text is null --> consider all is ok
Is it possible to do that with JMeter ?
Regards,
75Blured.
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Question about ResponseAssertion
Posted by 75blured <75...@gmail.com>.
Thanks a lot that is what I've found :)
Nice feature.
Regards,
75Blured.
Andrey Beznogov a écrit :
> Hi,
>
> it seems that you need more control over your assertion logic. Imo you
> should better try BeanShell Assertion
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Assertion
>
> where you can assert the response any way you want by writing some
> Java script to process everything and set the errors. There is even a
> sample script for it
>
> http://jakarta.apache.org/jmeter/demos/BeanShellAssertion.bsh
>
> which you could use as a starting point for your own.
>
>
> Or you could use BSF Assertion
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BSF_Assertion
>
> which does basically the same, only you can use JavaScript/JEXL there
> instead of Java.
>
> Regards,
> Andrey
>
>
> On Mon, Jul 28, 2008 at 8:25 PM, 75blured <75...@gmail.com> wrote:
>
>> Oups no it doesn't work...
>>
>> For example in the Login phase of a JAAS application in JBoss there is call
>> of /j_security_check. However sometime this returns a 302 HTTP code. So this
>> shouldn't be treated as an error which is always the case because the
>> reponse is null.
>>
>> +MyThread
>> + Login (call of /j_security_check) + call of other pages ...
>> + Vérification Reponse (= check response)
>>
>> I've got a "Vérification réponses" object which check the response text with
>> "not contains "Erreur"". As this object is applied to all of the pages the
>> Login page is also covered by this test.
>>
>> I've tried to use the jexl test however this doesn't correct the stuff.
>>
>> Have you got other way to make assertion with jmeter. I've only need :
>> . If (response != null && page.contain("Error")) {
>> assert("error");
>> }
>>
>> Regards,
>> 75Blured.
>>
>>
>> sebb a écrit :
>>
>>> On 24/07/2008, 75blured <75...@gmail.com> wrote:
>>>
>>>
>>>> Hello,
>>>>
>>>> I've got a generic ResponseAssertion in my test case. This
>>>> ResponseAssertion say to check that there is no the word "Erreur" in the
>>>> HTML page.
>>>> Here is the content of ResponseAssertion (translated from french GUI to
>>>> english) :
>>>> ResponseFieldToTest : ResponseText
>>>> Rules corresponding to the pattern : Contains + Not
>>>> Pattern to test : Erreur
>>>>
>>>> However when some requests success there is no text response return. So
>>>> those case are considered as error in JMetter which is not what I'd like
>>>> to
>>>> have.
>>>>
>>>> I'm looking to test :
>>>> if the Erreur word is present on html page --> consider that there is an
>>>> error
>>>> if the return text is null --> consider all is ok
>>>>
>>>> Is it possible to do that with JMeter ?
>>>>
>>>>
>>>>
>>> The only way to do that at present is to use a PostProcessor such as BSF.
>>>
>>> The following jexl script should do the trick:
>>>
>>> if (prev.getResponseData() == null) {
>>> prev.setResponseData("");
>>> }
>>>
>>> But I guess it might be sensible to allow a null response to succeed
>>> if the Not checkbox is selected.
>>>
>>>
>>>
>>>> Regards,
>>>> 75Blured.
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>>
>>>
>>
>
>
>
>
Re: Question about ResponseAssertion
Posted by Andrey Beznogov <an...@googlemail.com>.
Hi,
it seems that you need more control over your assertion logic. Imo you
should better try BeanShell Assertion
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Assertion
where you can assert the response any way you want by writing some
Java script to process everything and set the errors. There is even a
sample script for it
http://jakarta.apache.org/jmeter/demos/BeanShellAssertion.bsh
which you could use as a starting point for your own.
Or you could use BSF Assertion
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BSF_Assertion
which does basically the same, only you can use JavaScript/JEXL there
instead of Java.
Regards,
Andrey
On Mon, Jul 28, 2008 at 8:25 PM, 75blured <75...@gmail.com> wrote:
> Oups no it doesn't work...
>
> For example in the Login phase of a JAAS application in JBoss there is call
> of /j_security_check. However sometime this returns a 302 HTTP code. So this
> shouldn't be treated as an error which is always the case because the
> reponse is null.
>
> +MyThread
> + Login (call of /j_security_check) + call of other pages ...
> + Vérification Reponse (= check response)
>
> I've got a "Vérification réponses" object which check the response text with
> "not contains "Erreur"". As this object is applied to all of the pages the
> Login page is also covered by this test.
>
> I've tried to use the jexl test however this doesn't correct the stuff.
>
> Have you got other way to make assertion with jmeter. I've only need :
> . If (response != null && page.contain("Error")) {
> assert("error");
> }
>
> Regards,
> 75Blured.
>
>
> sebb a écrit :
>>
>> On 24/07/2008, 75blured <75...@gmail.com> wrote:
>>
>>>
>>> Hello,
>>>
>>> I've got a generic ResponseAssertion in my test case. This
>>> ResponseAssertion say to check that there is no the word "Erreur" in the
>>> HTML page.
>>> Here is the content of ResponseAssertion (translated from french GUI to
>>> english) :
>>> ResponseFieldToTest : ResponseText
>>> Rules corresponding to the pattern : Contains + Not
>>> Pattern to test : Erreur
>>>
>>> However when some requests success there is no text response return. So
>>> those case are considered as error in JMetter which is not what I'd like
>>> to
>>> have.
>>>
>>> I'm looking to test :
>>> if the Erreur word is present on html page --> consider that there is an
>>> error
>>> if the return text is null --> consider all is ok
>>>
>>> Is it possible to do that with JMeter ?
>>>
>>>
>>
>> The only way to do that at present is to use a PostProcessor such as BSF.
>>
>> The following jexl script should do the trick:
>>
>> if (prev.getResponseData() == null) {
>> prev.setResponseData("");
>> }
>>
>> But I guess it might be sensible to allow a null response to succeed
>> if the Not checkbox is selected.
>>
>>
>>>
>>> Regards,
>>> 75Blured.
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>
>
--
diem perdidi
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Question about ResponseAssertion
Posted by 75blured <75...@gmail.com>.
Oups no it doesn't work...
For example in the Login phase of a JAAS application in JBoss there is
call of /j_security_check. However sometime this returns a 302 HTTP
code. So this shouldn't be treated as an error which is always the case
because the reponse is null.
+MyThread
+ Login (call of /j_security_check)
+ call of other pages ...
+ Vérification Reponse (= check response)
I've got a "Vérification réponses" object which check the response text
with "not contains "Erreur"". As this object is applied to all of the
pages the Login page is also covered by this test.
I've tried to use the jexl test however this doesn't correct the stuff.
Have you got other way to make assertion with jmeter. I've only need :
. If (response != null && page.contain("Error")) {
assert("error");
}
Regards,
75Blured.
sebb a écrit :
> On 24/07/2008, 75blured <75...@gmail.com> wrote:
>
>> Hello,
>>
>> I've got a generic ResponseAssertion in my test case. This
>> ResponseAssertion say to check that there is no the word "Erreur" in the
>> HTML page.
>> Here is the content of ResponseAssertion (translated from french GUI to
>> english) :
>> ResponseFieldToTest : ResponseText
>> Rules corresponding to the pattern : Contains + Not
>> Pattern to test : Erreur
>>
>> However when some requests success there is no text response return. So
>> those case are considered as error in JMetter which is not what I'd like to
>> have.
>>
>> I'm looking to test :
>> if the Erreur word is present on html page --> consider that there is an
>> error
>> if the return text is null --> consider all is ok
>>
>> Is it possible to do that with JMeter ?
>>
>>
>
> The only way to do that at present is to use a PostProcessor such as BSF.
>
> The following jexl script should do the trick:
>
> if (prev.getResponseData() == null) {
> prev.setResponseData("");
> }
>
> But I guess it might be sensible to allow a null response to succeed
> if the Not checkbox is selected.
>
>
>> Regards,
>> 75Blured.
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
Re: Question about ResponseAssertion
Posted by 75blured <75...@gmail.com>.
Thanks a lot that's working !
sebb a écrit :
> On 24/07/2008, 75blured <75...@gmail.com> wrote:
>
>> Hello,
>>
>> I've got a generic ResponseAssertion in my test case. This
>> ResponseAssertion say to check that there is no the word "Erreur" in the
>> HTML page.
>> Here is the content of ResponseAssertion (translated from french GUI to
>> english) :
>> ResponseFieldToTest : ResponseText
>> Rules corresponding to the pattern : Contains + Not
>> Pattern to test : Erreur
>>
>> However when some requests success there is no text response return. So
>> those case are considered as error in JMetter which is not what I'd like to
>> have.
>>
>> I'm looking to test :
>> if the Erreur word is present on html page --> consider that there is an
>> error
>> if the return text is null --> consider all is ok
>>
>> Is it possible to do that with JMeter ?
>>
>>
>
> The only way to do that at present is to use a PostProcessor such as BSF.
>
> The following jexl script should do the trick:
>
> if (prev.getResponseData() == null) {
> prev.setResponseData("");
> }
>
> But I guess it might be sensible to allow a null response to succeed
> if the Not checkbox is selected.
>
>
>> Regards,
>> 75Blured.
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
Re: Question about ResponseAssertion
Posted by sebb <se...@gmail.com>.
On 24/07/2008, 75blured <75...@gmail.com> wrote:
> Hello,
>
> I've got a generic ResponseAssertion in my test case. This
> ResponseAssertion say to check that there is no the word "Erreur" in the
> HTML page.
> Here is the content of ResponseAssertion (translated from french GUI to
> english) :
> ResponseFieldToTest : ResponseText
> Rules corresponding to the pattern : Contains + Not
> Pattern to test : Erreur
>
> However when some requests success there is no text response return. So
> those case are considered as error in JMetter which is not what I'd like to
> have.
>
> I'm looking to test :
> if the Erreur word is present on html page --> consider that there is an
> error
> if the return text is null --> consider all is ok
>
> Is it possible to do that with JMeter ?
>
The only way to do that at present is to use a PostProcessor such as BSF.
The following jexl script should do the trick:
if (prev.getResponseData() == null) {
prev.setResponseData("");
}
But I guess it might be sensible to allow a null response to succeed
if the Not checkbox is selected.
> Regards,
> 75Blured.
>
> ---------------------------------------------------------------------
> 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