You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Michael.OBrien" <Mi...@ul.ie> on 2014/03/11 16:23:34 UTC

Display User Variable in Results

Hi Jmeter users,

I'd like to display or output the values of user defined variables but I've only come across instructions for re-using variables in additional http requests.

I don't see how the variable values can be graphed, charted or displayed using jmeter listeners
Is there a way for me to just dump the user variables out in View Results Tree or View Results in Table?

The test script I wish to create is to
1.      Contact the website at IP address XYZ
2.      Check for response code 200
3.      Use RegExp to extract www\d from the body to variable RespondingMachine
4.      Output and possible count each unique value of RespondingMachine


I'm using jmeter 2.11 without any extra plugins. I did find the RegExp Tester option in "View Results Tree" so my expression will work I'm just not sure how to get it to display alongside the table or tree

Anyone able to help me out?
Michael


RE: Display User Variable in Results

Posted by ZK <st...@gmail.com>.
Hi,
its not possible to chart counters in jmeter but could be done easily in
Excel


Another possibility would be to have a ramp up for your test i.e (10 seconds
before each thread starts (this is because you need time for the last thread
to end): so if you are running with 10 threads, have a ramp up of 100
seconds)

In your regEx extractor have the refernceName as:
RespondingMachine_${__threadNum}

then have a beanshell post processor to output to the console (or you could
change it to write to an external file)with something like:

import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.samplers.*;
import org.apache.jmeter.control.*;

currentVar= "RespondingMachine_"+${__threadNum}+"_matchNr";
totalThreads=JMeterContextService.getTotalThreads();

if (${__threadNum} == totalThreads){ // this is to check if it is the last
thread, hence the reason for the ramp up at the start of the test (not
perfect I know)
	int totalMatchNr;
	int i;
    	for (i = 1; i <= totalThreads; i++) {
		totalMatchNr=totalMatchNr+Integer.decode(vars.get(currentVar));
	 }
	print("Number Of Matches = "+totalMatchNr);
}


Maybe someone knows of a more elegant solution to determine if the test has
ended
Just some ideas for you anyway!

HTH

ZK




--
View this message in context: http://jmeter.512774.n5.nabble.com/Display-User-Variable-in-Results-tp5719555p5719570.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


RE: Display User Variable in Results

Posted by "Michael.OBrien" <Mi...@ul.ie>.
Hi ZK,

Thanks that debug sampler shows me my reg expression is working but I'm only really interested in the total number of matches for each occurrence after the thread group has finished executing (not the number of times its found in a single thread execution) and would ideally like to chart them 
Its to demo a load balancer does actually distribute the requests to different servers and I'd like to run jmeter for X threads and at the end have a chart that shows the total each server handled. 

Is it possible to chart counters in jmeter?  

Michael

-----Original Message-----
From: ZK [mailto:stevesenior69@gmail.com] 
Sent: 12 March 2014 09:07
To: jmeter-user@jakarta.apache.org
Subject: Re: Display User Variable in Results

Hi,
one possibility is: you could just use a debug sampler after the regular expression extractor this would list all the values you want to review

If you set the 'Match No.' of the Regular Expression Extractor to be -1 there will be a variable named: 'RespondingMachine_MatchNr', this would inform you of how many matches your regEx has found

Alternately you could write some beanshell code and output the variables to the console


ZK



--
View this message in context: http://jmeter.512774.n5.nabble.com/Display-User-Variable-in-Results-tp5719555p5719559.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: Display User Variable in Results

Posted by ZK <st...@gmail.com>.
Hi,
one possibility is: you could just use a debug sampler after the regular
expression extractor
this would list all the values you want to review

If you set the 'Match No.' of the Regular Expression Extractor to be -1
there will be a variable named: 'RespondingMachine_MatchNr', this would
inform you of how many matches your regEx has found

Alternately you could write some beanshell code and output the variables to
the console


ZK



--
View this message in context: http://jmeter.512774.n5.nabble.com/Display-User-Variable-in-Results-tp5719555p5719559.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: Display User Variable in Results

Posted by sebb <se...@gmail.com>.
On 11 March 2014 15:23, Michael.OBrien <Mi...@ul.ie> wrote:
> Hi Jmeter users,
>
> I'd like to display or output the values of user defined variables but I've only come across instructions for re-using variables in additional http requests.
>
> I don't see how the variable values can be graphed, charted or displayed using jmeter listeners
> Is there a way for me to just dump the user variables out in View Results Tree or View Results in Table?
>
> The test script I wish to create is to
> 1.      Contact the website at IP address XYZ
> 2.      Check for response code 200
> 3.      Use RegExp to extract www\d from the body to variable RespondingMachine
> 4.      Output and possible count each unique value of RespondingMachine
>
>
> I'm using jmeter 2.11 without any extra plugins. I did find the RegExp Tester option in "View Results Tree" so my expression will work I'm just not sure how to get it to display alongside the table or tree

Have you seen:

http://jmeter.apache.org/usermanual/listeners.html#sample_variables

> Anyone able to help me out?
> Michael
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org