Hi
if you are performing a functional test , ok. if you are performing a load
test - think about the number of samples. You arent going to show
individual samples in a report , on a load test right. And most of the time
only developers or testers understand parameters.
In any case , if you need it option a) or b).
For a)
In jmeter.properties (or equivalent) define
sample_variables=allArgs
This tells JMeter to write the value of the variable named allArgs to the
result file
Then assuming your test is something like
+ThreadGroup
++Sampler1
++Sampler2
++BeanShell Pre Processor (at this level so it applies to all samples)
Code is something like
import org.apache.jmeter.config.Arguments;
import java.util.Map;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
if(sampler instanceof HTTPSamplerBase) {
Arguments args = sampler.getArguments();
Map map = args.getArgumentsAsMap();
if(map != null) {
String s = map.toString();
vars.put("allArgs",s);
}
}
On Fri, Mar 25, 2016 at 7:19 PM, Prakash Palnati <
[email protected]> wrote:
> Deepak,
>
> Thanks for the answer. The reason being, I developed a custom HTML report
> from jtl file using xsl.
>
> I want my stakeholders to see the report in detail.
> On 25-Mar-2016 11:44 pm, "Deepak Shetty" <[email protected]> wrote:
>
> > A variable can be written to file using sample_variables (
> > http://jmeter.apache.org/usermanual/listeners.html#sample_variables) -
> > However thats probably not what you are looking for
> > If I understand correctly , you want the parameters that the Sampler is
> > sending , to be printed out in the JTL file . I can see two options
> >
> > a. If you are limiting yourself to HTTPSamplers , it should be possible
> to
> > write a Pre-processor that reads all the parameters on the sampler and
> > writes it as a single string to a pre-defined variable , and then you
> > configure that variable to be written using sample_variables
> > b. Write your own listener (or use a listener that allows you to write
> > custom code)
> >
> > However the question is why do you want to do this ? Is it to debug
> > failures ? In which case there are probably better ways to handle it (for
> > e.g. saving responses or diagnostic information only on errors) - I also
> > sometimes use variable names in the Assertion , so that it gives me
> enough
> > information when the assertion fails
> >
> > regards
> > deepak
> >
> > On Thu, Mar 24, 2016 at 8:26 PM, Prakash Palnati <
> > [email protected]> wrote:
> >
> > > Hi,
> > >
> > > Is there a way that I get the parameters that are being passed in each
> > > sample in a log file or a jtl file?
> > >
> > > Thanks in advance.
> > >
> > > Best,
> > > Prakash
> > >
> >
>