Performance Testing With Load Runner -4- : Working with LoadRunner (creating&recording scripts)

Working with LoadRunner

When testing or monitoring an environment, you need to emulate the true behavior of users on your system. HP testing tools emulate an environment in which users concurrently work on, or access your system. To do this emulation, the human was replaced with a virtual user, or a Vuser. The actions that a Vuser performs are described in a Vuser script. The primary tool for creating Vuser scripts is the Virtual User Generator, VuGen.

Vusers emulate the actions of human users by performing typical business processes in your application. The actions that a Vuser performs during the recording session are described in a Vuser script.

Using VuGen, you can run scripts as standalone tests. Running scripts from VuGen is useful for debugging as it enables you to see how a Vuser will behave and which enhancements need to be made.

Steps for Creating Scripts:

VuGen enables you to record a variety of Vuser types, each suited to a particular load testing environment or topology. When you open a new test, VuGen displays a complete list of the supported protocols.

Image
This window opens up as soon as you open the VuGen. You can select the protocol of you application and click ok. For most of the web application its Web (HTTP/HTML) Protocol

Open VuGen

To start VuGen, choose Start > Programs > <App_Name> (for example LoadRunner) > Applications > Virtual User Generator from the Start menu.

To open an existing script, not in the recent list, click Open Existing Script. To create a new script using a recent protocol, click the protocol in the Recently used protocols list.

To create a new script in a protocol that is not listed, click New Vuser Script.

Choose File > Zip Operations > Import From Zip File … to open an existing Script from a zip archive.

Image

Now click on the New Protocol Script and you will see the following Window. From this window you have to choose the protocol on which the application you are going to load test works.

VuGen provides a variety of Vuser technologies that allow you to emulate your system. Each technology is suited to a particular architecture and results in a specific type of Vuser script. For example, you use Web Vuser Scripts to emulate users operating Web browsers. You use FTP Vusers to emulate an FTP session. The various Vuser technologies can be used alone or together, to create effective load tests or Business Process Monitor profiles.

Image

Now set the General options for VuGen.

For Example To set the environment-related options:
Select Tools > General Options and click the Environment tab.

To save the current script information for auto recovery, select the Save AutoRecover Information option and specify the time in minutes between the saves.

To set the editor font, click Select Font. The Font dialog box opens. Select the desired font, style, and size and click OK. Note that only fixed size fonts (Courier, Lucida Console, FixedSys, and so on) are available.

To use a comparison tool other than WDiff, select Use custom comparison tool and then specify or browse for the desired tool.

Click OK to accept the settings and close the General Options dialog box.

Now Set the Recording Options for recording the user actions of the application under load test.

Image

Image

Now that you are ready for recording Click on the record button

Image

Give the Url of the application that needs to be load tested like the one below

Image

The following table describes the criteria for determining the business functions or processes to be included while recording 

Image

Now record the transaction in either Vuser_init or Vuser_end or action by using the recording tool bar.

Image

Once the recording is over a recording log is also generated

To view a log of the messages that were issued during recording, click the Recording Log tab. You can set the level of detail for this log in the advanced tab of the Recording options.

Now the script will be generated for the recorded user actions and will be displayed like this 

Image

Advertisements

BPEL structured activities: Flow With Eclipse -4-

BPEL’s Flow activity

  1. Create a new BPEL project named “BPEL_Flow” by selecting File→New→Others→BPEL 2.0→BPEL Project. Select Next. Type the project name as BPEL_Flow and select the Target Runtime as Apache ODE 1.x Runtime. Click Finish.
  2. Create a new BPEL process file named FlowSample by right clicking on the BPEL_Flow/bpelContent folder, select New→Others→BPEL 2.0→New BPEL Process File. Click Next. Fill in BPEL Process Name the stringFlowSample, and in the Namespace the string http://flow.bpel.tps. Select the Template as Synchronous BPEL Process. Click Finish.
  3. Modify the Service Address as http://localhost:8080/ode/processes/FlowSample (suppose that your Tomcat environment is running on port 8080). Click Finish.
  4. Open FlowSample.bpel file. Click and drag the Flow control from the Palette to the process, between the receiveInput and replyOutput actions. Drag two Sequence controls and two Assign actions to the Flow. Insert another Assign above the replyOutput action. 
  5. At the Variables view, click on the Add(+) symbol to add two new variables. Name them as flow1 and flow2
  6. Click on the variable flow1, in the Properties view, select Details→Browse. Select the type of this variable is {http://www.w3.org/2001/XMLSchema}string. Keep the Namespace mapping as ns1. Select Ok
  7. Select the variable flow2 and set its type as ns1:string.
  8. Click on the Assign action in the Sequence1, in its Properties view, select Details→New. Assign the fix value ” is executed by the flow 1” to the variable flow1
  9. By the same way, at the Assign1 action, assign the string ” and the flow 2.” to the variable flow2.
  10. At the Assign3 action, add the expression concat($input.payload/tns:input,$flow1,$flow2) to the variable output→payload→result. A pop-up dialog appears, select Yes
  11. Save the files. Right click on the BPEL_Flow/bpelContent folder, select New→Others→BPEL 2.0→Apache ODE Deployment Descriptor. Click Next. Verify that the name of BPEL Project is /BPEL_Flow/bpelContent. Click Finish.
  12. Open the deploy.xml file. And select the Associated port with the Partner Link client is FlowSamplePort.
  13. Save file and open the Server view, right click on the Ode v1.x Server at localhost, select Add and Remove Projects. Select the BPEL_Flow in the Available projects box and click Add. Then, click Finish.
  14. Start the ODE server and use the Eclipse’s Web Services Explorer to test our application. If you deploy the process successfully, you will see the result like the following: 

     

Siebel SmartScript

Siebel SmartScript allows business analysts, call center managers, and Siebel developers to create scripts to define the application workflow for interactive customer communications. The script determines the flow of the interaction, not the agent or customer.

 Terminology

· Script: The object that contains all subsidiary content and procedural elements for directing the workflow for an interaction. It consists of a name and a collection of pages, and the branches needed to move between the pages.

· Page: The logical grouping of questions within a page that display together for the user.

· Question: A script element that is a question to be asked of customers, or a text message that provides information to the agent. Questions are displayed on pages.

· Answer A script element that represents an answer to a question. Answers appear as data entry fields or as any of several types of UI elements, including check boxes, drop-down lists, and multi-value groups.

· Translation: A text string used to display script elements in languages other than the original, so that scripts can be used in multilingual call centers.

· Branch: The transfers of control inside a SmartScript that define the display and processing sequence of pages or questions. Script branches transfer control from a question in one page to a question in another page, while Page branches transfer control from one question to any other question within a single page. NOTE: Page branches override script branches.

· Page section: The logical grouping of questions within a page that display together to the user at one time.

clip_image002

About Data Storage in Siebel SmartScript

■ In a generic answer table. This table is always available without further configuration. This

storage method is particularly useful when data is to be summarized later through an external

system. Data stored in answer tables can be extracted for external processing by using the Siebel Enterprise Integration Manager.

■ In a particular business component field.

Steps to Create Smart Script

1. Understand your business scenario, and map out your design.

2. Create questions and translations.

3. Create answers.

4. Create pages: In the First Question field, select the question that you want to appear first on the page.

5. Create the script.

6. Add questions to pages.

7. Add pages to the script.

Example of Creating a Simple SmartScript

In this example we shall create a SmartScript to edit the Consumer record. The final Solution should something look like below

clip_image004

We need the following Elements

1. Five Questions for Capturing the following Consumer details

a. First Name – Text

b. Last Name – Text

c. Title – Dropdown(will have Answers Mr. Miss. Dr. Mrs.)

d. Email Address – Text

e. Job Title – Text

2. Two Pages to hold these Questions

3. One Script to hold the two pages

Create Questions

1. Navigate to Administration SmartScript -> Questions and Create a New Record

clip_image006

Enter the Details in More Info tab

· Name: Name of the Question

· Answer Type: Type of Input Argument

· Answer Control: What input field will be used Dropdown, radio button etc.

· Must Answer: Used to make a Answer required.

· Save Business Object: Business Object

· Save Bus Comp: Business Component

· Save Field: BC Field

Enter the Details in Translations Tab: The string entered here will be displayed on the screen

clip_image008

Enter the Details in Answers Tab:

Some of the Questions may have predefined answers when the Answer Control is Dropdown, Checkbox or radio button.

clip_image010

Creating Pages

Enter the following details for creating a new Page

· Name of the Page

· First Question: First Question to appear on the page.

· Translation Details: This Label will appear on the top of page

clip_image012

Designer Tab

In the designer tab link all the questions which should appear on that page using the workflow

clip_image014

Create Script

Once all the pages are created, link all the pages using the script

Following details are required

· Name: The Name of the SmartScript

· Language: Language for the translation

· Label: This label will be displayed on all the Script pages for the OM language

clip_image016

Link all the pages using the Designer tab

clip_image018

Once all the pages are linked, a branch is seen in the Branches tab.

clip_image020

Verify the Script

Once the script is ready verify it using the Smartscript verification tool

From the Menu Bar select “verify”

clip_image022

clip_image024

If there are no errors following screen will be seen.

clip_image026

Releasing the SmartScript

From the Scripts view click on the Release Button

clip_image028

After Clicking the Release button in the Translations tab the “Released” flag will be checked and the Released date will be populated.

clip_image030

Invoking SmartScript

Invoking SmartScript using the “RunCallScript” method

RunCallScript, invokes a SmartScript from an applet so the SmartScript updates the currently active record.

RunCallScript positions the SmartScript on the currently active record from the applet from which the SmartScript was invoked. This can be invoked by filling in the Method invoked property of the button to be RunCallScript.

RunCallScript SmartScriptName, pathID, language, currency

Siebel Applet Button Examples

Function WebApplet_PreInvokeMethod (MethodName As String) As IntegerSub

if MethodName = “MyRunCallScript” then

InvokeMethod “RunCallScript”, “Pentium II Script”,””,”ENU”,”USD”

WebApplet_PreInvokeMethod = Cancel Operation

else

WebApplet_PreInvokeMethod = ContinueOperation

end if

End Function

We will try to invoke this method using a custom button.

1. Open Siebel Tools, Locate and Lock the Applet where we need to add the new button.(ex. Consumer List Applet)

2. Add the new Control as seen below

Name Call Script
Caption Script…
Caption – String Reference SBL_SCRIPT…-1009113206-JML
HTML Row Sensitive Y
HTML Type MiniButtonEditNew
Method Invoked RunCallScript

clip_image032

3. Map the Control to the Applet Placeholder using “Edit Web Layout” option.

4. Compile the Applet object.

5. Navigate to Administration – SmartScripts à Views

6. Query for the view name containing the above applet(View: Consumer List View) and add the name of the SmartScript to invoke in the Auto SmartScript field

clip_image034

7. Click on the Clear Cache button.

8. Navigate to the Consumer List View to test the SmartScript

clip_image036

clip_image038

9. Click on the Script.. button to invoke the script

clip_image039

Setting SmartScripts to Open Automatically

SmartScripts can run automatically when a user navigates to a particular view. In this example when the user Navigates to the Consumer List View the SmartScript should start automatically.

clip_image041

To configure SmartScripts to run automatically, add the SmartScript Player applet to the view, and associate a SmartScript with the view.

1. Use Siebel Tools to add the SmartScript Player applet to a view. Applet Name: Smart Script Player Applet (Player Only)

clip_image043

2. You may also need to add the concerned BusComp to the BusObj.

4. Navigate to Administration – SmartScript screen > Views view.The list of available views appears.

5. Select the view that activates a SmartScript when this view is accessed.

6. In the Auto SmartScript field, select the SmartScript to run when the view selected clip_image034[1]

Invoking Scripts Using Siebel VB or Siebel eScript

RunSmartScript: This function invokes a SmartScript programmatically. This function has extra parameters View Name and Applet Name. The viewName parameter allows a view other than the default agent’s SmartScript view to be accessed. This is useful if an alternative view is configured for a specific purpose. The view specified must contain an instance of the SmartScript Player Applet to present the SmartScript interface to the agent.

RunSmartScript callScriptName, pathId, language, currency, viewName, appletName

clip_image045

Siebel VB Example

InvokeMethod “RunSmartScript”, “Pentium II Script”, “”, “ENU”, “USD”

Siebel eScript Example

InvokeMethod (“RunSmartScript”, “Pentium II Script”, “”, “ENU”, “USD”);

Siebel Applet Button Example

Sub ButtonScript_Click

TheApplication.InvokeMethod “RunSmartScript”, “Pentium II Script

End Sub

RUN TOAD FOR ORACLE ON MAC OS X

Prerequisites

  • CrossOver for Mac
  • GDI+ library (for Toad version 11.5 only)
  • Toad for Oracle MSI installer
  • Oracle Instant Client

As excited as I am that Toad runs on Mac within CrossOver, I have to temper things a bit by admitting that it has not been fully tested. You may also find that this may or may not work with your specific OS/software/version combination. So, until this is fully tested, verified, and officially supported by Quest, please understand that your mileage may vary.

Configuration

My System:

  • 13” MacBook Pro (2.5GHz Intel i5, 8Gb RAM)
    • OS X Lion 10.8.3
  • CrossOver for Mac 11.0.3
    • Toad for Oracle 11.0 (professional, commercial)
    • GDA+ library
    • Oracle Instant Client 11.2.0.3 for WINDOWS  (32-bit)

Toad for Oracle MSI installer 

https://support.quest.com/Search/SoftwareDownloads.aspx?ProductID=268435520&ProductName=Toad%20for%20OracleOracle Instant Client
Download the 32-bit Instant Client – Basic and Instant Client – SQL*Plus from http://www.oracle.com/technetwork/topics/winsoft-085727.html

CrossOver for Mac (www.codeweavers.com)
It’s about $50 for a license, but you can start with a 14-day trial to give you enough time to try..

Step 1: Install CrossOver for Mac
This is real straightforward. If you get stuck here, stop; this article probably isn’t for you.

Step 2: Install Toad for Oracle
Installation via CrossOver is pretty straightforward:

  1. Go to Configure > Install Software… and select “Unsupported Application”
  2. Next, select your Toad for Oracle MSI installer by clicking on the “Select an installer” section. Use the first option: “Choose Installer File”
  3. In the next section, choose “New winxp Bottle…” and give it a name
  4. Click Install and step through the Toad for Oracle installer.
  5. CAUTION: If installed Toad for Oracle v11.5 you will need to instll the GDI+ library first. Otherwise, CrossOver will crash when you launch Toad. You can download & install it from here: http://www.codeweavers.com/compatibility/browse/name/?app_id=8227. Make sure you install it into teh same Bottle as Toad for Oracle 11.5.
  6. Once everything is installed, you should have a shiny new Toad icon in your Launchpad!

Step 3: Connectivity and Environment Variables

Now that we have Toad installed, we need to configure our instant client. Assuming you’ve already downloaded the two packages referenced above, go ahead and unzip them. I recommend placing them all together into a single directory like /instantclient_11_2.

Now create /network/admin folder inside there. This is where we’ll place the tnsnames.ora file (which we have to create). Open your favorite text editor (mine’sTextWrangler) and create your tnsnames.ora file using this structure below. Be sure to replace hostname and SID with the appropriate data for your Oracle instance.

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SID)
)
)

CAUTION: If you’re using TextEdit, stop. TextEdit likes to default to RTF formatting which will wreak havoc with Oracle’s OCI. Save yourself the headache of troubleshooting connection problems and avoid using RTF format…

Once you have your instant client folder arranged and your tnsnames.ora file created, you’ll need to move it over to the C:\ drive of the CrossOver emulator. From CrossOver, click Configure > Manage Bottles… and select your new bottle. Click on the “Advanced” tab and then the “Open C: Drive in Finder” button.

Copy your shiny new /instantclient_11_2 folder to the root of C:\ as you see here:

Next, we need to run regedit to add a few environment variables. Back over to CrossOver, click Configure > Manage Bottles… and select your bottle. Click on the “Control Panel” tab and choose “Task Manager”.

In the Task Manager, click File > New Task (run…) and enter “regedit”

Now let’s add some keys. First, navigate to \HKEY_CURRENT_USER\Environment and add a new String Value as “PATH” with data “c:\instantclient_11_2”.(NOTE: If PATH already exists, just append c:\instantclient_11_2 to the end, separated by a semi-colon.)

Next, navigate to \HKEY_LOCAL_MACHINE\SOFTWARE and add a new key named “Oracle.” Then add a new String Value as “ORACLE_HOME” with data “c:\instantclient_11_2”. Lastly, add one more String Value as “TNS_ADMIN” with data “c:\instantclient_11_2\network\admin”.

Let’s check our configuration and see if we’ve got everything set up properly. From the CrossOver menu click Programs > Run Command… In the new window which opens, use the dropdown to select the appropriate Bottle and then expand Debug Options and click “Open Shell.” This will open a terminal window on the Mac and set the environment variables to CrossOver’s Bottle. To invoke the Windows Command Prompt just type wine cmd. If all goes well you should see a familiar C:\> prompt. Type in “sqlplus” to step into SQL*Plus and connect using your Net Service name defined in the tnsnames.ora file

If you can’t connect at this point, I think it’s a good idea to fiddle with your tnsnames.ora and double check your network settings before moving on.

Now that we’ve installed everything and verified connectivity, let’s fire up Toad for Oracle! You can use that shiny new Toad icon in your Mac OS X Launchpad or run it from CrossOver’s menu by clicking Programs > Quest Software > Toad for Oracle > Toad for Oracle 11

The program seems to run fine for most things, though the painting of windows seems a little slow.

LoadRunner out of memory exception for virtual user with a large web_req_save_param value

This applies to LR 11.x and LR 9.x using the web (http/html) protocol.

Sometimes it’s necessary in loadrunner to capture a large amount data with a web_reg_save_param function.  Let’s say we want to capture an entire page response into a param for data extraction.

First off we need to set web_set_max_html_param_len(“X00000″); to be able to capture the entire page size in the script vuser_init. If your setting is too small your web_reg_save_param function will throw an error.

Normally that’s all you need to do to get the script working in vugen. However when you kick off a test you may run into issues. Here are some of the errors you may encounter:

Error -26000: Error: Out of memory !
Error — memory violation : Exception ACCESS_VIOLATION received.

I have found that when you run a large number of these virtual users under a single LR process you can run into memory issues and either the load generator or loadrunner process will terminate unexpectedly.

If you open up Run-time Settings for your script in HP Virtual User Generator -> General -> Miscellaneous so will see that the default setting for Multithreading is set to ‘Run Vuser as a process’.

Most of the time changing this setting to ‘Run Vuser as a thread’ will resolve your issues assuming your load generators have enough free memory to run your XX virtual users each under their own mdrv.exe process. Basically if you run 500 users on a single LG you will see 500 instances of this process present.

If your system doesn’t have enough memory for the above setting something else to try is reducing the number of threads that run under a single mdrv.exe process.

Open C:Program FilesHPLoadRunnerconfigwlrun7.ini

Modify the key AgentMaxThreadsPerDriver=50 to 25 or lower.

This will force loadrunner to spawn more instances of mdrv.exe since each process can only the number of VUs specified by the above key.