On Aug 30, 2006, at 12:54 PM, sebb wrote:

Check the Mailing list archives - this has been asked a few times
before, most recently earlier this month, if I recall correctly.

S.
On 30/08/06, Sacha Michel Mallais <[EMAIL PROTECTED]> wrote:
Hello all,

I'm a JMeter newbie, so please forgive me if this is an obvious
question:

I have a web app that generates a user name and password for each
user that registers.  I'd like to be able to capture the user name
and password in a couple of variables (which I've already managed to
do with a Regex extractor) and write those values to a CSV file for
use in a later test run.

Is that possible?  I tried looking in the User Manual, but the only
thing that seems like it would work would be to write a Java class
that did it and set up JMeter to use a Java sampler to send the data
to that Java class.  Seems pretty clunky -- is there a better way?

Took me a few days to figure out how to do this (and I didn't find much help in the existing archives for my situation), so for posterity, here is what I did:

- created a couple of Regular Expression Extractors to extract the user name and password

- created a shell script appenduserpass, as follows:
#!/bin/sh

cd `dirname $0`

echo -n $1 >> userpass.txt
echo -n "       " >> userpass.txt
echo $2 >> userpass.txt

- finally, added a BeanShell preprocessor to the final sampler of the thread group with the following script: exec("/Full/path/to/script/appenduserpass " + vars.get("username") + " " + vars.get("password"));


sacha


--
Sacha Michel Mallais             Senior Developer / President
Global Village Consulting Inc.   http://www.global-village.net/
PGP Key ID: 7D757B65             AIM: smallais
ObAd: read "Practical WebObjects" <fnord>
http://www.global-village.net/products/practical_webobjects



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to