Mike,
I downloaded and built the 02-13-2003 source. It fixed the regex fucntion problem but
I still can't get it to work entirely.
The first regex call is to get the datasetName. Here is how I construct it in Helper
dialog.
RegEx: value="(.*)" onChange="javasrcipt:validateDatasetName
Tempalte: $1$
Which match: 1
Between text:
Default text:
name of Function: datasetName
generates this function call:
${__regexFunction(%22%28.*%29%22+onChange%3D%22javasrcipt%3AvalidateDatasetName,%241%24,1,,,datasetName)}
>From this piece of html text:
<input type="text" name="datasetName" class="formcontrol"
onChange="javascript:setDirty()"
value="Northwind3" onChange="javasrcipt:validateDatasetName()">
we get in the datasetName.
Northwind3
This works as expected.
The next regex for getting the dataset id is:
RegEx: '(.*)','\$\{datasetName\}'\)">Delete
Tempalte: $1$
Which match: 1
Between text:
Default text:
name of Function: datasetid
Generates this function call:
${__regexFunction(%27%28.*%29%27%2C%27%5C%24%5C%7BdatasetName%5C%7D%5C%29%22%3EDelete,%241%24,1,,,datasetid)}
>From this piece of text:
<a
href="javascript:delDataset('0a0a48ce00bb9829000000f348febce48004','Northwind3')">Delete</a>
we get:
0a0a48ce00bb9829000000f348febce48004
This gets correctly substituted into HTTP request 'id' parameter first time:
http://localhost:80/metadata/action/selectDataset?id=7f00000100f81402000000f35493ea2c8004
After this request I have another request without any parameters and then I have a
request for delete.
The delete request uses ${datasetid} the second time but it does NOT get substituted.
I get this url.
http://localhost:80/metadata/action/deleteDataset?id=${datasetid}
Any ideas? Looks like the 'datasetid' variable is lost. Should it persist through
the entire session?
Thanks,
Swavek
-----Original Message-----
From: Mike Stover [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 13, 2003 10:40 AM
To: JMeter Users List
Subject: Re: How to get regular expression with parameter?
The problem is, the function syntax is not parsed in a recursive manner, and
embedding a function as the parameter to another function is not possible right
now.
However, if you grab the latest code from CVS, you can use the new regex
Extractor, which will work as you desire (I just verified being able to do exactly
what
you described below).
And, FYI, functions are multi-thread aware, and would keep values separate on a
per thread basis.
-Mike
On 13 Feb 2003 at 9:52, Lorenc, Swavek wrote:
> Hi
>
> I am trying to setup a multiuser test for my web application.
>
> My test creates entities called datasets. Datasets have ids which are guids and
>names.
>
> Users see names but links for selecting the datasets contain ids.
> e.g.
> <a href='selectDataset?id=7f00000100f81402000000f35493ea2c8004'>Northwind1</a>
>
> In my test I create a dataset and the system assigns it a unique name.
> After it has been saved I return to the page which contains a list of datasets.
>
> From this page I want to go to the page that lets me edit a dataset that was just
>created.
>
> Then I return to the list page and finally I want to delete the created dataset.
>
> My problem is that I would like to setup this test for more than one user and I
>can't extract
> the dataset id based on dynamically assigned name.
>
> After I created the dataset I extract the name assigned by the system with
>__regexFunction and store
> it in datasetName parameter. BTW, I added this parameter to user parameters as well
>because I thought it is
> needed if I have more than one user. Is this necessary? Will the results of
>__regexFunction be put in a
> separate instance of datasetName user parameter if I am running multiple threads.
>
> Once I get back to the page with list of datasets I want to extract the id, but the
>link that I
> parse to get it contains the name that is dynamic. In case above it is
>'Northwind1'. But for the next user
> it will be 'Northwind2' or 'Northwind3' if 2 is already used up.
>
> I created regular expression like this for extracting the id and putting it in the
>user parameter 'datasetid' :
> 'selectDataset\?id=(.*)'>\$\{datasetName\}</a>
>
> which translates into a call to __regexFunction.
>
>${__regexFunction(%27selectDataset%3Fid%3D%28.*%29%27%3E%24%7BdatasetName%7D%3C%2Fa%3E,%241%24,1,,,datasetid)}
>
> unfortunately it doesn't work and I get an empty datasetid.
>
> How could accomplish this behavior?
>
>
> Swavek Lorenc
> Senior Software Engineer
> SPSS, Inc,
> 312-651-3566
> [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
Michael Stover
[EMAIL PROTECTED]
Yahoo IM: mstover_ya
ICQ: 152975688
AIM: mstover777
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]