The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP / Mercury LoadRunner

Pages: 1 | 2 | (show all)
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: BooKa]
      #716569 - 09/17/12 12:23 PM

(Duplicate post removed.)

Edited by ptrussell_nc (09/19/12 07:53 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: BooKa]
      #716639 - 09/18/12 03:24 PM

Timeout vs. Wait
-----------------

A common issue we run into with TruClient is due to timing
issues in the applications. Often times when you click a Submit button on a form it might take awhile for the application to come back. Normally TruClient waits 20 seconds by default and if the page has not come back it will fail.

One solution I have seen used is to put a WAIT statement in the script. Although this might work, it is not the best solution. The reason is because a WAIT statement will do exactly that it will wait the specified time, whether it needs to or not. If the wait was not long enough the script will still fail. It you set it too long the users are just sitting there doing nothing. This causes your test to not do as much activity as you would want.

A better solution would be to place a VERIFY statement in the script right after the SUBMIT. Basically you VERIFY that something came back on the screen. This has 2 benefits. First the VERIFY is a great way to make sure the app is doing what is should. Next is you can set the Object Timeout and Step Timeout to large values. They will wait a MAXIMUM of these value, but if the screen comes back faster, then the user will continue as soon as it can.


Post Extras: Print Post   Remind Me!   Notify Moderator  
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: swales]
      #718335 - 10/18/12 11:05 AM

Q. How do I Capture data (like a web_reg_save_param)?
A. Use the "Visible Text" Property

Set the Step - Action to Get Property
Set the Arguments - Property to "Visible Text"
Set the Variable to the name of the parameter you want (ex. "myproduct") <- note the quotes around the parameter name
Set the Object - ID Method to XPath
Set the XPath to one that is using an object path rather than the original text (ex. Agriculture)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Devendra_Singh
Member


Reged: 09/20/12
Posts: 27
Loc: India
Re: SWales - TruClient Knowlege Base [Re: swales]
      #718477 - 10/21/12 11:05 PM

Very good thread Swales. Appreciate your effort of making things available at one place.

Thanks,

--------------------
Devendra Singh
http://performancetestingcentre.blogspot.com/


Post Extras: Print Post   Remind Me!   Notify Moderator  
xtom
Member


Reged: 01/19/04
Posts: 100
Loc: Germany
Re: SWales - TruClient Knowlege Base [Re: Devendra_Singh]
      #718573 - 10/23/12 01:42 AM

AJAX TruClient - Correlation

The following describes how to do some kind of correlation in AJAX TruClient protocol. The flow in my case is to create a new offer record, take the generated offer number from the screen, search for this number in the search dialog and change the record to be shure that the new record was processed and correlation worked as desired.

Everything needs to be done in Firefox (Develop script)!

Step 1
After recording find the skript step where the offer number is shown on the screen. I think this should be the earliest step where the value appears at the first time.

Step 2
Open the Toolbox and drag the step "Verify" from the "Functions" area after the step located above.

Step 3
The new inserted step displays the value 'Click to choose an object'. Before this is clicked it is necessary to navigate in Firefox to the screen that contains the value that has to be correlated.

Step 4
Click the value 'Click to choose an object' in the new step and touch the value that has to be correlated in Firefox. The area of this value is highlited in green.
The description of the script step changes to something like: '"Visible Text" contains "AP1-197269-01E"'.

Step 5
Expand the new step and open the "Step" area. Substitute the value for "Action" to use "Get Property" instead of "Verify"

Step 6
Open the "Arguments" area. Select the property "Visible Text" and enter the name for the variable. This name needs to be enclosed in double quotation marks. In this example it will be "Angebotsnummer".

Step 7
Open the "Object" area. Select the "ID Method" as "XPath". Then select in the drop down list for "XPath" field the value that does not contain the explicit value. For example i do NOT select this "//span[text()="AP1-197269-01E"]", i select this "/html/body/form/table[2]/tbody/tr[2]/td/table[6]/tbody/tr/td[2]/table/tbody/tr/td[2]/span[2]".

Step 8
To verify if the above configuration is correct, open the Toolbox again and add one more step. Drag the step "Evaluate JavaScript" from the "Miscellaneous" area after the step just created above.

Step 9
Expand the new step and open the "Arguments" area. Enter the command "window.alert(Angebotsnummer)" (without double quotes) in the field "Code".

Step 10
Execute the script to verify the success. The step created above will cause an alert window pop up that displays the value captured from the screen. This should be the same like in the application.

Step 11
Reuse the captured value as input for the search dialog to find the newly created offer number. To do this the according step where the number is used as input needs to be found. In my case the step contained the information 'Type "AP1-197269-01E" in Angebotsnummer textbox' was displayed in the step.

Step 12
Expand the step and open the "Arguments" area. Substitute the existing value "AP1-197269-01E" by the variable name "Angebotsnummer" (without double quotes).

Step 13
Delete the step where the alert pop up was inserted, because it will disturb the script flow.


Restrictions:
I do not know how to correlate values that are not displayed on the screen and i do not know if this is necessary in AJAX TruClient.

Regards
Thomas

--------------------
xtom


Post Extras: Print Post   Remind Me!   Notify Moderator  
Grabelke
Newbie


Reged: 11/09/12
Posts: 2
Re: SWales - TruClient Knowlege Base [Re: BooKa]
      #719671 - 11/12/12 03:13 AM

Hello swales,

thanks a lot for sharing the helpful information about TruClient.

I have a question about how can i get the (dynamic)value of an object.

I am trying to record an Ajax application with the TruClient protocol.
I have several testusers for the login. After the login the fullname of the testuser is displayed in the application. I would like to "find out" (capture) the fullname for each user and it later in the script. How can I do this in TruClient? Should I use "Evaluate JS on Object"? How should the JS look like?

Thanks in advance for your help.


Post Extras: Print Post   Remind Me!   Notify Moderator  
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: Grabelke]
      #719688 - 11/12/12 07:41 AM

Grabelke,
See my post about 'Visible Text' above. It does what you are looking for.


Post Extras: Print Post   Remind Me!   Notify Moderator  
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: swales]
      #719701 - 11/12/12 11:17 AM

Object Identification... Automatic vs. XPath vs. JavaScript

Most issues involving "Object not Found" errors can be resolved by changing the Object Identification from Automatic to XPath or JavaScript.

As of Patch 3 LoadRunner will generate multiple XPath options. Most often one of these options will contain the TEXT of what you see on the screen and the other will contain the DIV path of the object.

Example - Here are 2 XPath options generated by LoadRunner
//b[text()="Working Account:"]

or

/html/body/form/div[2]/center[1]/table[2]/tbody/tr/td[1]/b

If the text of the object is not expected to change then choose the XPath that is simplest (eg. contains the text). If the text does change between iterations, then choose the other XPath option with the DIV path.

If you need to refine the XPath you will need to use the JavaScript option. LoadRunner will generate an evalXPath() function with the XPath. You can then alter this XPath to refind what is returned.

Also remember to validate your selection by using the Highlight option. See next post on debugging XPaths.


Post Extras: Print Post   Remind Me!   Notify Moderator  
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: swales]
      #719702 - 11/12/12 11:37 AM

Debugging XPaths

See previous post on Object Identification. Once you have changed your selection to XPath you need to know how to debug the XPath statements... especially if you are trying to alter the selection.

LoadRunner provides a great feature to help debug XPaths. it is the Highlight button on the Object tab of the statement. Start by navigating to the right page... you can simply run the script until you get to the statement you are debugging. Click Highlight button. LoadRunner will draw a red box around the object it finds that matches the XPath.

Now lets make it interesting. Lets say you have a list of radio buttons on the screen. You recorded clicking on one of the radio buttons, but what you REALLY want to do is randomly choose one of the available radio buttons.

Set the ID Method to JavaScript, then click to Edit the JavaScript. You will see an evalXPath statment such as this:

evalXPath("//table[@id=\"dataTable\"]/tbody/tr[1]/td[1]/input");

If you alter the XPath like this it will select all the radio buttons:

evalXPath("//table[@id=\"dataTable\"]/tbody/tr[1]/td/input");

Notice the last [1] was removed. Since the reference to a specific radio button was removed from the XPath, it looks for all objects matching.

Now here is the cool part. If you click the Highlight button now... LoadRunner will highlight each object that matches. So you will see the red box being drawn around each object. This helps you verify you found all the objects you wanted.

Now to randomly select one of them you can make the following change.

var options = evalXPath("//table[@id=\"dataTable\"]/tbody/tr[1]/td/input)

random(options);

This saves all the objects returned into a variable called options. Then the random() function will select one of them and return it.

I also recommend installing the FireBug add-on. It has some great features to find XPaths. Simply press F12 to activiate FireBug, then right click on an object and choose Inspect. The you can hover over the code to get the XPath... also right-click to Copy XPath.

Hope this helps.


Post Extras: Print Post   Remind Me!   Notify Moderator  
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: swales]
      #719703 - 11/12/12 11:49 AM

XPath Contains Clause

I had a situation where the app I was testing had a list of Products on the screen. Some of the Products had RED text and some GREEN text. The test case called for only choosing from the RED Products.

I discovered I could use a Contains clause in my XPath statement to do what I needed.

My original XPath was:
var products = evalXPath("/html/body/form/div/table[2]/tbody/tr[3]/td/div/div/label");

I altered it to:
var products = evalXPath("/html/body/form/div/table[2]/tbody/tr[3]/td/div/div/label[contains(@style,'red')]");

Now only the RED Products were returned in my products variable.

Another similar situation was where the Products were in a folder list that could be expanded or collapsed. I needed to only select from the list that was expanded.

var products = evalXPath("/html/body/form/div/table[2]/tbody/tr[3]/td/div/div[contains{@class,'ajaxtree_open')]");

Without the contains clause the script was selecting Products from all list whether they were expanded or not.

Again I used FireBug to 'see' what what happening in the code when I expanded or collapsed the Product. This helped me discover the class was changing.

Another useful tip? Let me know if you find these useful and I will continue my efforts to post.

Thanks.


Post Extras: Print Post   Remind Me!   Notify Moderator  
swales
Junior Member


Reged: 07/11/02
Posts: 173
Loc: Moline,IL
Re: SWales - TruClient Knowlege Base [Re: swales]
      #719896 - 11/19/12 10:03 AM Attachment (449 downloads)

How to select a random option from a listbox... and optionally skip the first option.

Many times the developers will use the first option in a listbox to provide instructions to the user.. ex.. (Please select option)... well if you randomly pick from the listbox you MIGHT pick this option... which is not really a valid selection the developer intended.

This attached article will describe how to work around this in TruClient.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1 | 2 | (show all)



Extra information
0 registered and 36 anonymous users are browsing this forum.

Moderator:  AJ, James Pulley, ptrussell_nc, JimHowell1970 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating: ****
Topic views: 42796

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5