Tuesday, October 11, 2011

Using LoadRunner to capture SOAP requests generated using soapUI application

Problem:
How to capture soapUI request(s) in LoadRunner.

Assumption:
1: A SOAP request has already been created in soapUI. I am using Metric Weight Unit Convertor WSDL from webserviceX for this problem.

Solution:
1: Select an Web HTTP/HTML protocol in LoadRunner.

2: In Start Recording window, input the following options:
Application type: Win32 Applications
Program to record: "...\HP\LoadRunner\bin\micexec.exe" -->micexec.exe path
Program arguments: "...\soapUI-4.0.0.exe" -->soapUI path

3: Click OK button. This launches the soapUI application.

4: Run the SOAP request in soapUI. You will notice that LoadRunner is now capturing the soapUI traffic.

5: Stop the LoadRunner recording, once soapUI has finished submitting the request. You will notice that the same request created in soapUI has been captured in LoadRunner.

6: Replay the script in the LoadRunner and you will notice that the correct response is returned.

NOTE:
You might get "The JVM could not be started. The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could block the execution" error message.

You can fix this issue by updating the -Xmx value in the soapUI-4.0.0.vmoptions file. Reduce the size JVM Xmx value. In my case, I reduced it from 1200 to 512. This fixed the issue and I was able to record the script. You might also get OutOfMemory issue when launching soapUI using LoadRunner. This is because the maximum heap size set in soapUI is less than the memory required by soapUI to successfully launch. Increase the heap size to what the soapUI application requires or remove the unnecessary projects.

Saturday, October 1, 2011

Using Regular expression and SaveLen attribute in LoadRunner

Problem:
How do you capture a variable in LR that has a dynamic right boundary?

Example:
Depending on the data I used in a project (Siebel Project), the right boundary of a row ID that I wanted to capture from a response would change. For example,
1: Data set 1 would return following response - ...*Y1*Y10*1-1YK-49251*11*11*N1*...
2: Data set 2 would return following response - ...*Y1*Y10*1-2XY-45233*11*11*N1*...
3: Data set 3 would return following response - ...*Y1*Y10*1-1KM-72142*11*11*N1*...

In the above response, I needed to capture the row ID "1-1YK-4925","1-2XY-4523" & "1-1KM-7214" respectively. As you can see, the right boundary is different for different data set and therefore just passing left and right boundary values in web_reg_save_param, would fail or/and capture wrong row ID value.

web_reg_save_param("rowID","LB=*Y1*Y10*","RB=1*11*11*N1*",LAST); --Will fail for data set 2 & 3. Same thing will happen if you are using RB from data set 2 and 3.
web_reg_save_param("rowID","LB=*Y1*Y10*","RB=*11*11*N1*",LAST); --will fail for all data sets because an extra character is saved in Temp parameter.

Possible solution:
As you might have noticed, the row ID that we want to capture consists of 10 characters and therefore we could use one of the following approaches to solve this problem:

1: SaveLen attribute- since we know that the number of characters for row ID, we can use SaveLen Attribute in web_reg_save_param function to capture the correct value.

2: Regular expression- Second approach is to use regular expression to capture the row ID. Their is a really good blog written by Dmitry Motevich on how to use regular expression in LoadRunner.

To demonstate the above two approaches in Siebel, I have used three parameters to save the row ID value from the server response (see the image below):

1: SubActivityIDWithoutRegAndNoSaveLen - this parameter is captured using web_reg_save_param without SaveLen attribute. In this case a wrong value is captured.

2: SubActivityIDWithoutRegAndSaveLen - this parameter is captured by passing SaveLen value in web_reg_save_param function. In this case a right value is captured.

3: SubActivityIDWithReg - this parameter is captured using web_reg_save_param and then passed into the regular expression function to get correct rowID. In this case the pattern that matches the above value is "\\d-[0-9A-Z]{3}-[0-9A-Z]{4}" and right value is returned.

From the RunTime Data window you can see that the final value of the parameter captured using the regular expression and SaveLen attribute are the same.


Therefore, depending on your situation, you might be able to use any one of these approaches to capture a value that has dynamic boundaries.

ALM - CLoader error

Issue:
CLoader error is encountered when accessing the HP ALM application via IE8 on Windows 7 for the first time, even if you are an administrator.

Solution:
Open IE8 using "Run as administrator" option.