Is it possible to use a value from a LoadRunner web request response in the next subsequent request? - request

Performance Engineering tool: LoadRunner 11
Protocol: Silverlight
The scenario:
1. A call is made (by the Silverlight application) to the web server to generate a unique identifier (UID)
2. The server returns a response with the UID
3. The application uses that UID to save Patient record (in this scenario, UID is Unique Patient Id)
The problem:
We would like to use the ID received in the Step 2's Web Response (say, as a local variable) and replace it in the next subsequent request sent by LoadRunner.
Please advise whether the same is possible.
*In parallel trying to figure out if "web_reg_save_param" will solve our problem.*
------------ LoadRunner data --------------------
1. Call to generate Uid
ignored as it is too large to paste here and irrelevant
2. Response from server (The UID is UNI-0000001544)
HTTP/1.1 200 OKCache-Control: privateContent-Type: application/msbin1Content-Encoding: gzipVary: Accept-EncodingServer:
Microsoft-IIS/7.5X-AspNet-Version: 4.0.30319X-Powered-By: ASP.NETDate:
Fri, 06 Jul 2012 05:41:27 GMTContent-Length:
188#GenerateSequenceResponsehttp://tempuri.org/#GenerateSequenceResultâ„¢UNI-0000001544
3. Next LoadRunner request where the UID (UNI-0000001543) has to be replaced with the UID received in the response
web_custom_request("SubmitChanges",
"URL=http://infinityappload/ClientBin/Infinity-Web-Services-ActorDomainService.svc/binary/SubmitChanges",
. . .
, "BodyBinary=#\rSubmitChanges\
. . .
\tPatientID\\x99\\x0EUNI-0000001543\
... LAST);

This is, as James said, the idea of correlation. The simplified approach would go as follows:
web_reg_save_param("UID2", "LB=GenerateSequenceResultâ„¢", "Savelen=14", LAST);
//The TM symbol will have to be replaced by whatever HTML code is used.
web_custom_request("WebRequest1", ....);
web_custom_request("SubmitChanges", "URL=http://infinityappload/...",
...
"BodyBinary=#\rSubmitChanges\",
"\tPatientID\\x99\\x0E{UID2}\",
LAST);
Values that are to be correlated are going to be determined prior to the request they will be populated by. They can then be used in any subsequent requests. Just make sure that, when using a correlated parameter, it is inside a quoted string.

The concept you are referring to is the management of correlated variables, it is a core concept in the use of performance test tools, LoadRunner included. This particular concept is the subject of nearly 1/3 of the standard LoadRunner script development product training. I would refer you to information on correlation for both web and silverlight protocols in the system documentation. Also, it is critical for your short and long term success that you pair yourself with both a strong mentor as well as attending some form of standard product training.

Related

Selenium Webdriver - How to avoid data duplication

Suppose I have normal "Add Users" module that I want to automate using Java scripting, how I can avoid data duplication to avoid error message such as "User already exist"?
There are numerous ways in which this can be automated. You are receiving 'User already exists' due to fact that you're (probably) running your 'Add Users' test cases using static variables.
Note: For the following examples I will consider a basic registration flow/scenario of a new user: name, email, password being the required fields.
Note-002: My language of choice will be JavaScript. You should be able to reproduce the concept with Java with ease.
1.) Pre-pending/Post-pending a unique identifier to the information you're submitting (e.g.: Date() returns the number of seconds that have elapsed since January 1, 1970 => it will always be unique when running your test case)
var timestamp = Number(new Date());
var email = 'test.e2e' + timestamp + '#<yourMainDomainHere>'
Note: Usually, the name & password don't need to be unique, so you can actually use hardcoaded values without any issues.
2.) The same thing can also be achieved using the Math.random() (for JS), which returns a value between 0 and 1 (0.8018194703223693), 18 digits long.
var almostUnique = Math.random();
// You can go ahead and gen only the decimals
almostUnique = almostUnique.toString().split('.')[1];
var email = 'test.e2e' + almostUnique + '#<yourMainDomainHere>'
!!! Warning: While Math.random() is not actually unique, in hundreds of regression runs of 200 functional test cases, I didn't have the chance of seeing a duplicate.
3.) (Not so elegant | Harder exponentially harder to implement) If you have access to your web-apps backend API and through it you can execute different actions in the DB, then you can actually write yourself some scripts that will run after your registration test cases, like a cleanup suite.
These scripts will have to remove the previously added user from your database.
Hope this helps!
You don't mention what language you are coding in, but use whatever language you use's random function to generate random numbers and/or text for the user id. It won't guarantee that there will not be a duplicate, but the nature of testing is such that you should be able to handle both situations anyway. If this is not clear or I don't understand your question correctly, you'll need to provide a lot more information: what you've tried, what language you use, etc.

How to get the output of a powershell command into an array

I am trying to get the output of a powershell command into an array, but it seems not to work. In fact I want to address the output with a row and a column index.
e.g.
$a=Get-Service
With output (part)
Status Name DisplayName
------ ---- -----------
Stopped AeLookupSvc Application Experience
Stopped ALG Application Layer Gateway Service
Stopped AppIDSvc Application Identity
Running Appinfo Application Information
Stopped AppMgmt Application Management
I want to address for the second line the DisplayName, e.g.
$a[2][2]
And it should give then
Application Layer Gateway Service
But this does not seem to work.
Can anybody help?
This type of question makes me think that you're probably coming from a Unix background, and are accustomed to having to deal with indicies and column index, that sort of thing.
Fundamentally, PowerShell is an object-oriented scripting language. You simply don't need to do what you're asking about here.
For instance, if you want to capture the results, then grab a property for one of the objects, here's how that's done.
First, capture the output.
$a=Get-Service
Now, you want a particular property of a particular entity. To get that, index into the object you want.
>$a[2]
Status Name DisplayName
------ ---- -----------
Stopped AJRouter AllJoyn Router Service
To select the .DisplayName, all you have to do is append that to the end of your previous command.
> $a[2].DisplayName
AllJoyn Router Service
If you want to select multiple values, you could use this approach instead.
#Select multiple values from one entity
$a[2] | select DisplayName, Status
>DisplayName Status
----------- ------
Application Layer Gateway Service Stopped
#Select multiple values from each in the array
$a | select DisplayName, Status
>DisplayName Status
----------- ------
Adobe Acrobat Update Service Running
AllJoyn Router Service Stopped
Application Layer Gateway Service Stopped
Application Identity Stopped
This is not possible without a mapping from property names to array indices. Note that what you see in the output is just a partial list of properties (defined in an XML file somewhere). So there isn't even an easy way to convert those to array indices.
However, I also don't quite understand your need here. You can get the second service with $a[1], as expected. And then you can get its DisplayName property value with $a[1].DisplayName. PowerShell uses objects throughout. There is simply no need to fall back to text parsing or cryptic column indices just to get your data. There's an easier way.
The output from Get-Service that you see in the Console may look like an array (as it is formatted as a table when sent to the Console), but it is actually an 'System.ServiceProcess.ServiceController' object.
Rather than using row and column designations, you need to use the name of the property to retrieve it, so for your example:
$a[2].DisplayName will return Application Layer Gateway Service

What is the EAN's signature mechanism ? They use MD5?

I see EAN'S signature's document like the following:
http://developer.ean.com/docs/getting-started/api-authentication
SIG = MD5("{APIKey}{APISecret}{UnixTimestamp in second}")
When using the digital signature, the value of sig is calculated by generating an MD5 hash made up of the API key, the API user’s shared secret, and a UNIX timestamp.
The system accepts timestamps up to five minutes before or after the server timestamp to accommodate for reasonable clock drift.
And they show the sample url only contains ApiKey, not include timestamp
http://api.ean.com/ean-services/rs/hotel/v3/avail?cid=[yourCID]&apiKey=[yourAPIKey]&sig=[youSigValue]&minorRev=[current minorRev #]&customerUserAgent=[xxx]&customerIpAddress=[xxx]&locale=en_US&currencyCode=USD&hotelId=201252
My question is :
How they detected my request whether in five minutes before or after the server time???
Compare MD5 result 600 times??

Salesforce rest api Events WhoId

I am using salesforce rest api to pull meeting data.There is a field "WhoId" in the reponse which according to the documentation is the related lead or contact id .How do i find whether it is a lead or contact?
You can always tell what sort of object an ID corresponds to by looking at the first 3 letters. In your case, you'd look for a prefix of 00Q (Lead) or 003 (Contact).
See: https://salesforce.stackexchange.com/q/1653
Backup copy of the full table gisted (just in case!) and rendered for your future convenience.

How to aggregate files in Mule ESB CE

I need to aggregate a number of csv inbound files in-memory, if necessary resequencing them, on Mule ESB CE 3.2.1.
How could I implement this kind of logics?
I tried with message-chunking-aggregator-router, but it fails on startup because xsd schema does not admit such a configuration:
<message-chunking-aggregator-router timeout="20000" failOnTimeout="false" >
<expression-message-info-mapping correlationIdExpression="#[header:correlation]"/>
</message-chunking-aggregator-router>
I've also tried to attach mine correlation ids to inbound messages, then process them by a custom-aggregator, but I've found that Mule internally uses a key made up of:
Serializable key=event.getId()+event.getMessage().getCorrelationSequence();//EventGroup:264
The internal id is everytime different (also if correlation sequence is correct): this way, Mule does not use only correlation sequence as I expected and same message is processed many times.
Finally, I can re-write a custom aggregator, but I would like to use a more consolidated technique.
Thanks in advance,
Gabriele
UPDATE
I've tried with message-chunk-aggregator but it doesn't fit my requisite, as it admits duplicates.
I try to detail the scenario I need to cover:
Mule polls (on a SFTP location)
file 1 "FIXEDPREFIX_1_of_2.zip" is detected and kept in memory somewhere (as an open SFTPStream, it's ok).
Some correlation info are mantained for grouping: group, sequence, group size.
file 1 "FIXEDPREFIX_1_of_2.zip" is detected again, but cannot be inserted because would be duplicated
file 2 "FIXEDPREFIX_2_of_2.zip" is detected, and correctly added
stated that group size has been reached, Mule routes MessageCollection with the correct set of messages
About point 2., I'm lucky enough to get info from filename and put them into MuleMessage::correlation* properties, so that subsequent components could use them.
I did, but duplicates are processed the same.
Thanks again
Gabriele
Here is the right router to use with Mule 3: http://www.mulesoft.org/documentation/display/MULE3USER/Routing+Message+Processors#RoutingMessageProcessors-MessageChunkAggregator

Resources