jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Epp, Jeremiah W (Contractor)" <j...@cas.org>
Subject RE: Saving responses while recording (from code)
Date Tue, 12 Apr 2016 14:41:31 GMT
> -----Original Message-----
> From: Philippe Mouawad [mailto:philippe.mouawad@gmail.com]
> Sent: Tuesday, April 12, 2016 08:45
> To: dev@jmeter.apache.org
> Subject: Re: Saving responses while recording (from code)
> 
> If you mean that you need the response from api of Proxy then you will have
> to contribute a PR.

That would be cool, but I already noted it's a TODO for ProxyControl.deliverSampler().  I
considered doing that, but I'd be blocked on the same thing I'm blocked on already: getting
the response from the proxy at all.

> If not, then just put a View Results Tree under Proxy where filename is
> setup and request/response will be saved in xml or csv depending on your
> choice.
>
This is basically what I'm trying to do for now.  Except without the GUI.

What does " put a View Results Tree under Proxy " look like from a code standpoint?

I've been digging at the JMeter code for days, now, and I cannot for the life of me figure
out the underlying mechanism for associating an AbstractVisualizer (presumably, it'd be this
because SimpleDataWriter is basically a no-op) with a ProxyControl object such that I can
then save the output to an XML file.  It's obviously possible because I can get it to work
in the GUI.

Right now, I have something like this:

        SimpleDataWriter writer = new SimpleDataWriter();
        writer.setEnabled(true);
        ResultCollector collector = (ResultCollector) writer.createTestElement(); //This SHOULD
set up the default ResultCollector
        collector.setFilename("/tmp/response.xml");
        proxyControl.addTestElement(collector); //This is probably where I've gotten it wrong

But when I hit the breakpoint after I stop the proxy and look at the ResultCollector, nothing's
been saved.  That last line is probably wrong, but it's not clear what is right.  I can't
add the writer itself because it's not a TestElement, but the other add* methods for ProxyControl
make even less sense.  ResultCollector implements TestStateListener, so notifyTestListenersOfStop()
should work on it, but since it's not getting populated, something is clearly not set up right.
 But what?

Regards,
Wyatt

Confidentiality Notice: This electronic message transmission, including any attachment(s),
may contain confidential, proprietary, or privileged information from Chemical Abstracts Service
("CAS"), a division of the American Chemical Society ("ACS"). If you have received this transmission
in error, be advised that any disclosure, copying, distribution, or use of the contents of
this information is strictly prohibited. Please destroy all copies of the message and contact
the sender immediately by either replying to this message or calling 614-447-3600.

Mime
View raw message