jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abram Catalano <ab...@adaptx.com>
Subject Re: JDBC response assertions
Date Mon, 07 Jan 2008 23:58:17 GMT
 > This can get complicated, so it might be useful to extend the JDBC 
sampler to make such checks easier.
Yeah, I'm not bad at regex, but I'd rather deal with columns, values and 
newlines as structured data.

 > Bugzilla can be used for enhancement requests too ... but it might be 
best to discuss the proposal on JMeter user first. I'll start a thread 
if no-one beats me to it.


What I've done locally here is add 1) "rawResponseData" to 
SampleResult.java 2) add res.setRawResponseData(data) in JDBCSampler.  
Code below.  There are a bunch of cases I didn't catch with this  (when 
_queryType != SELECT).

 if (SELECT.equals(_queryType)) {
                stmt = conn.createStatement();
                ResultSet rs = null;
                try {
                    rs = stmt.executeQuery(getQuery());
                    Data data = getDataFromResultSet(rs);
                    res.setRawResponseData(data);
                    res.setResponseData(data.toString().getBytes());
                } finally {
                    close(rs);
                }


Then, I have the rawResponseData Data object available in BeanShell.  
Quick example:

 (BeanShell code)

import org.apache.jorphan.collections.*;
System.out.println("Headers");
header = SampleResult.getRawResponseData().getHeaders();
System.out.println("header length = "+header.length);





---------------------------------------------------------------------
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