You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Raúl Lorenzo <ra...@altia.es> on 2008/02/20 12:53:26 UTC

Response Assertion problems

Hi,

I am probing a test case with a WebService(SOAP) Request, the problem is 
that assertion fails when I think that it should ends successfully.

The configuration of assertion is:
    Response Field To Test: Test Response
    Pattern Matching Rule: Contains
    Patterns to Test: ${TestCaseResponse}      Is a variable getted from 
CSV source

The response data getted from webservice is:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><SendRequestResponse 
xmlns="http://ncd/eReceita/services"><SendRequestResult>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==</SendRequestResult></SendRequestResponse></soap:Body></soap:Envelope>


${TestCaseResponse} value is 
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==

So, the assertion should be correct, isn´t it?

The assertion result is:

Assertion error: false
Assertion failure: true
Assertion failure message : Test failed: text expected to contain 
/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==/

Any idea?

Thanks in advance

-- 
Raúl Lorenzo Boullosa
Desarrollador Aplicaciones Informáticas

Altia Consultores S.L.
http://www.altia.es

C/Colón nº18, 3ºA
36201 Vigo (Pontevedra - España)
Telf: +34 986 446 191
Fax: +34 986 439 128
Email: raul.lorenzo@altia.es


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


Re: Response Assertion problems (WORKAROUND-SOLVED)

Posted by sebb <se...@gmail.com>.
On 20/02/2008, Raúl Lorenzo <ra...@altia.es> wrote:
> sebb escribió:
>  > On 20/02/2008, Raúl Lorenzo <ra...@altia.es> wrote:
>  >
>  >> Ok, this makes sense, but how can I escape the response data?
>  >>
>  >
>  > Just edit the file.
>  >
>  of course, but this is not the way :D

That may depend on the test requirements :D

>  > Or you could use Javascript or Jexl functions to do a global replace
>  > on the string before using it.
>  >
>  > The latter is more versatile, but of course has to be done for every test run.
>  >
>  I am trying to use BeanShell Assertion to compare it extrictly.
>

That's another approach, but likely to be a bit more resource intensive.

>  Thanks for your ideas

No problem.

BTW, the next release of JMeter will have a "Substring" option for the
Response Assertion.

>  --
>  Raúl Lorenzo Boullosa
>  Desarrollador Aplicaciones Informáticas
>
>  Altia Consultores S.L.
>  http://www.altia.es
>
>  C/Colón nº18, 3ºA
>  36201 Vigo (Pontevedra - España)
>  Telf: +34 986 446 191
>  Fax: +34 986 439 128
>  Email: raul.lorenzo@altia.es
>
>
>  ---------------------------------------------------------------------
>  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: Response Assertion problems (WORKAROUND-SOLVED)

Posted by Raúl Lorenzo <ra...@altia.es>.
sebb escribió:
> On 20/02/2008, Raúl Lorenzo <ra...@altia.es> wrote:
>   
>> Ok, this makes sense, but how can I escape the response data?
>>     
>
> Just edit the file.
>   
of course, but this is not the way :D
> Or you could use Javascript or Jexl functions to do a global replace
> on the string before using it.
>
> The latter is more versatile, but of course has to be done for every test run.
>   
I am trying to use BeanShell Assertion to compare it extrictly.

Thanks for your ideas

-- 
Raúl Lorenzo Boullosa
Desarrollador Aplicaciones Informáticas

Altia Consultores S.L.
http://www.altia.es

C/Colón nº18, 3ºA
36201 Vigo (Pontevedra - España)
Telf: +34 986 446 191
Fax: +34 986 439 128
Email: raul.lorenzo@altia.es


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


Re: Response Assertion problems

Posted by sebb <se...@gmail.com>.
On 20/02/2008, Raúl Lorenzo <ra...@altia.es> wrote:
> Ok, this makes sense, but how can I escape the response data?

Just edit the file.

Or you could use Javascript or Jexl functions to do a global replace
on the string before using it.

The latter is more versatile, but of course has to be done for every test run.

> Is there any other manner for comparing data strictly without needing
> escaping it?

Not at present, unless you want to match the entire string using "Exact".
It might be useful to add "Substring" as an option.

> This piece of code is formated in BASE64

So at least you know which "special" characters may be present...

> sebb escribió:
> > On 20/02/2008, Raúl Lorenzo <ra...@altia.es> wrote:
> >
> >> Hi,
> >>
> >> I am probing a test case with a WebService(SOAP) Request, the problem is
> >> that assertion fails when I think that it should ends successfully.
> >>
> >> The configuration of assertion is:
> >>     Response Field To Test: Test Response
> >>     Pattern Matching Rule: Contains
> >>     Patterns to Test: ${TestCaseResponse}      Is a variable getted from
> >> CSV source
> >>
> >> The response data getted from webservice is:
> >> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
> >> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><SendRequestResponse
> >> xmlns="http://ncd/eReceita/services"><SendRequestResult>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==</SendRequestResult></SendRequestResponse></soap:Body></soap:Envelope>
> >>
> >>
> >> ${TestCaseResponse} value is
> >> PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==
> >>
> >> So, the assertion should be correct, isn´t it?
> >>
> >>
> >
> > No, because the variable contains Regex metacharacters such as + which
> > means repeat the previous character.
> >
> > These need to be escaped with \ - for example bzI\+Yz
> >
> > Alphanumerics and spaces are OK, and = is OK, but other characters are not:
> >
> > + * . \ ( ) [ ] { }
> >
> > In your case, I think only the + characters need escaping.
> >
> >
> >> The assertion result is:
> >>
> >> Assertion error: false
> >> Assertion failure: true
> >> Assertion failure message : Test failed: text expected to contain
> >> /PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==/
> >>
> >> Any idea?
> >>
> >> Thanks in advance
> >>
> >> --
> >> Raúl Lorenzo Boullosa
> >> Desarrollador Aplicaciones Informáticas
> >>
> >> Altia Consultores S.L.
> >> http://www.altia.es
> >>
> >> C/Colón nº18, 3ºA
> >> 36201 Vigo (Pontevedra - España)
> >> Telf: +34 986 446 191
> >> Fax: +34 986 439 128
> >> Email: raul.lorenzo@altia.es
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
>
> --
> Raúl Lorenzo Boullosa
> Desarrollador Aplicaciones Informáticas
>
> Altia Consultores S.L.
> http://www.altia.es
>
> C/Colón nº18, 3ºA
> 36201 Vigo (Pontevedra - España)
> Telf: +34 986 446 191
> Fax: +34 986 439 128
> Email: raul.lorenzo@altia.es
>
>
> ---------------------------------------------------------------------
> 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: Response Assertion problems

Posted by Raúl Lorenzo <ra...@altia.es>.
Ok, this makes sense, but how can I escape the response data?
Is there any other manner for comparing data strictly without needing 
escaping it?

This piece of code is formated in BASE64

sebb escribió:
> On 20/02/2008, Raúl Lorenzo <ra...@altia.es> wrote:
>   
>> Hi,
>>
>> I am probing a test case with a WebService(SOAP) Request, the problem is
>> that assertion fails when I think that it should ends successfully.
>>
>> The configuration of assertion is:
>>     Response Field To Test: Test Response
>>     Pattern Matching Rule: Contains
>>     Patterns to Test: ${TestCaseResponse}      Is a variable getted from
>> CSV source
>>
>> The response data getted from webservice is:
>> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
>> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><SendRequestResponse
>> xmlns="http://ncd/eReceita/services"><SendRequestResult>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN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TGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==
>>
>> So, the assertion should be correct, isn´t it?
>>
>>     
>
> No, because the variable contains Regex metacharacters such as + which
> means repeat the previous character.
>
> These need to be escaped with \ - for example bzI\+Yz
>
> Alphanumerics and spaces are OK, and = is OK, but other characters are not:
>
> + * . \ ( ) [ ] { }
>
> In your case, I think only the + characters need escaping.
>
>   
>> The assertion result is:
>>
>> Assertion error: false
>> Assertion failure: true
>> Assertion failure message : Test failed: text expected to contain
>> /PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==/
>>
>> Any idea?
>>
>> Thanks in advance
>>
>> --
>> Raúl Lorenzo Boullosa
>> Desarrollador Aplicaciones Informáticas
>>
>> Altia Consultores S.L.
>> http://www.altia.es
>>
>> C/Colón nº18, 3ºA
>> 36201 Vigo (Pontevedra - España)
>> Telf: +34 986 446 191
>> Fax: +34 986 439 128
>> Email: raul.lorenzo@altia.es
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>   


-- 
Raúl Lorenzo Boullosa
Desarrollador Aplicaciones Informáticas

Altia Consultores S.L.
http://www.altia.es

C/Colón nº18, 3ºA
36201 Vigo (Pontevedra - España)
Telf: +34 986 446 191
Fax: +34 986 439 128
Email: raul.lorenzo@altia.es


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


Re: Response Assertion problems

Posted by sebb <se...@gmail.com>.
On 20/02/2008, Raúl Lorenzo <ra...@altia.es> wrote:
> Hi,
>
> I am probing a test case with a WebService(SOAP) Request, the problem is
> that assertion fails when I think that it should ends successfully.
>
> The configuration of assertion is:
>     Response Field To Test: Test Response
>     Pattern Matching Rule: Contains
>     Patterns to Test: ${TestCaseResponse}      Is a variable getted from
> CSV source
>
> The response data getted from webservice is:
> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><SendRequestResponse
> xmlns="http://ncd/eReceita/services"><SendRequestResult>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFu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mU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==
>
> So, the assertion should be correct, isn´t it?
>

No, because the variable contains Regex metacharacters such as + which
means repeat the previous character.

These need to be escaped with \ - for example bzI\+Yz

Alphanumerics and spaces are OK, and = is OK, but other characters are not:

+ * . \ ( ) [ ] { }

In your case, I think only the + characters need escaping.

> The assertion result is:
>
> Assertion error: false
> Assertion failure: true
> Assertion failure message : Test failed: text expected to contain
> /PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48UmVzcENvbnN1bHRhQ29sZWdpYWRvIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vTkNEL2VSZWNlaXRhL3JlcXVlc3QvUmVzcENvbnN1bHRhQ29sZWdpYWRvL3YxXzAiPjxSZXNwdWVzdGFPcGVyYWNpb24+PENvZGlnb1Jlc3B1ZXN0YT4wPC9Db2RpZ29SZXNwdWVzdGE+PC9SZXNwdWVzdGFPcGVyYWNpb24+PExpc3RhQ29sZWdpYWRvcz48Q29kaWdvQ29sZWdpYWRvPjUwMzQ1NjExSDwvQ29kaWdvQ29sZWdpYWRvPjxOb21icmU+YTwvTm9tYnJlPjxBcGVsbGlkbzE+YjwvQXBlbGxpZG8xPjxBcGVsbGlkbzI+YzwvQXBlbGxpZG8yPjxBY3Rpdm8+dHJ1ZTwvQWN0aXZvPjwvTGlzdGFDb2xlZ2lhZG9zPjwvUmVzcENvbnN1bHRhQ29sZWdpYWRvPg==/
>
> Any idea?
>
> Thanks in advance
>
> --
> Raúl Lorenzo Boullosa
> Desarrollador Aplicaciones Informáticas
>
> Altia Consultores S.L.
> http://www.altia.es
>
> C/Colón nº18, 3ºA
> 36201 Vigo (Pontevedra - España)
> Telf: +34 986 446 191
> Fax: +34 986 439 128
> Email: raul.lorenzo@altia.es
>
>
> ---------------------------------------------------------------------
> 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