jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sonam Chauhan" <sonam.chau...@ce.com.au>
Subject RE: Hassles generating text assertions
Date Thu, 11 Dec 2003 03:09:49 GMT
Sorry Jordi - my mistake. I tested quotemeta, and it does work. A tab
characters in the text was getting lost copying-pasting to a command
line. :( 

So quoting simple documents like this works fine for generating
assertions:
------------
bash$ cat unquoted.txt | perl -lne 'print \Q$_\E' > quoted.txt
------------

The problem is the response documents I am dealing with have this
response header, and has encoded characters for copyright, trademark,
etc:
	Content-Type: text/html; charset=8859_1
Copying/pasting from JMeter to a file does not appear to suitably save
the appropriate charset encoding.  (At least the assertions still don't
match)

Do you have ideas of what I may be doing wrong, or otherwise suggest how
I could quote a document with this charset for use in assertions? Is
there a quotemeta-like Java class I could use?

> Forgot to add - an easy way to test Assertions (and indeed other
aspects 
>  of test scripts) is to use the Java Sampler.

Thanks Seb - I'm not aware of this functionality - I'll look into it. 

With regards,
Sonam Chauhan
-- 
Corporate Express Australia Ltd.
Phone: +61-2-9335-0725, Fax: 9335-0753, Email: sonamc@ce.com.au
 

> -----Original Message-----
> From: Jordi Salvat i Alabart [mailto:jsalvata@atg.com]
> Sent: Thursday, 11 December 2003 2:19 AM
> To: JMeter Users List
> Subject: Re: Hassles generating text assertions
> 
> Hi Sonam,
> 
> I've been testing. The Response Assertion seems to be handling escaped
> spaces, quotes, brackets, etc. nicely. In any case, if it doesn't,
it's
> a bug, since the org.apache.oro.text.regex package description says:
> "Any other backslashed character matches itself." Which means that
> quotemeta is perfectly appropriate for your purpose (although it tends
> to escape too much: it essentially escapes all non-alphanumeric
> characters).
> 
> Please double-check your tests.
> 
> --
> Salut,
> 
> Jordi.
> 
> 
> En/na Sonam Chauhan ha escrit:
> > Hi -
> >
> > I have run into problems getting JMeter to do text assertions on
certain
> > HTML text.
> >
> > I want JMeter response assertions to ensures HTML snippets like the
one
> > below occur in the HTTP response:
> > --------------------------------------------------------
> > <input type="hidden" name="NEW_ITEM-DESCRIPTION[1]" value = "Leader
ohp
> > trolley">
> > --------------------------------------------------------
> >
> > This requires that things like the quotation mark ('"'), be escaped.
> JMeter
> > uses Jakarta-ORO which implements Perl-compatible regular
expressions
> (doco:
> > http://jakarta.apache.org/oro/index.html). So I figured  using Perl
> > quotemeta could escape the text properly:
> > --------------------------------------------------------
> > bash$ perl -le 'print quotemeta q/<input type="hidden"
> > name="NEW_ITEM-DESCRIPTION[1]" value = "Leader ohp trolley">/'
> > --------------------------------------------------------
> >
> > That gave me:
> > --------------------------------------------------------
> > \<input\ type\=\"hidden\"\ name\=\"NEW_ITEM\-DESCRIPTION\[1\]\"\
value\
> \=\
> > \"Leader\ ohp\ trolley\"\>
> > --------------------------------------------------------
> >
> > This worked to an extent. The problem is that Jakarta-ORO/JMeter
does
> not
> > like certain things Perl quotemeta does -- like the escaping of
spaces
> ('\
> > '), or escaping square brackets ('\[1\]').
> >
> > Can anyone let me know a good way to escape the HTML snippets above
so
> that
> > JMeter can use it in a response assertions?
> >
> > With regards,
> > Sonam Chauhan
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message