jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Lee <mleejrs...@yahoo.com>
Subject Re: file comparison
Date Thu, 18 Dec 2008 19:23:01 GMT
I guess I've stumped everyone so I'll answer my own question;
To compare an XML snippet against part of a file use HTTP Request with file protocol to load
the file.
Ad a Response Assertion.
Check 'Text Response' and 'Contains'

In the 'pattern to test' put the xml snippet you wish to check for in your file.
EXCEPT, at the very beginning of the XML, add (?s) and at the end of every line add (.*).
The (?s) tells it to make it a multiline and the (.*) at the end tells it to ignore the end
of line no matter what it format it's in (windows, unix, etc).
Not too bad...a bit of monkey work, but it is the easiest way I could find.
I hope this helps.
Mike




________________________________
From: Mike Lee <mleejrspam@yahoo.com>
To: jmeter-user@jakarta.apache.org
Sent: Thursday, December 18, 2008 9:42:26 AM
Subject: file comparison

I would like to compare a part of a file to a given string. We have a web application that
calls web services. It generates a log file of the send and receive xml messages. I would
like to take one of these log files and create a test case from it where I can take each xml
send message and use it to compare it to the receive xml log file. We cant use the web service
request because I have to compare based upon what our application sends. That involves comparing
the files. I can't seem to do 'contains' because it wants a regular expression and I have
this huge xml. I use an HTTP Request and use the FILE protocol and load the file. I use a
response assertion to try to compare an xml section from what the send or receive data should
look like in the log files.

I put on the 'substring' check box and put something like this in the 'patterns to test'

            <MSGVARS>
                <VAR NAME="RESULTS">DPR0007</VAR>
                <VAR NAME="SERVERTIMESPENT">0.000</VAR>
                <ROWSET NAME="DPR0007">
                    <ROW NUM="1">
                        <VAR NAME="INIGROUP">WipData</VAR>
                        <VAR NAME="INIOPTION">Path</VAR>
                    </ROW>
                </ROWSET>
                <ROWSET NAME="ERRORS">
                    <ROW NUM="1">
                        <VAR NAME="CODE">DPR0007</VAR>
                    </ROW>
                </ROWSET>
            </MSGVARS>

but it doesnt work.
If I break up each line and put it in and do a 'contains' then it does. Problem with that
is order doesn't matter and these are big files and I need to be able to compare a chunk of
data as above.

Summary: How do I check if a multi-line string exists in a file?

Thanks


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message