Monday, January 2, 2012

Analysis Report contains transaction numbers instead of transaction names

Problem statement:
While generating analysis report the transaction summary has numbers instead of transaction names. This issue is seen mostly in case of test being run in performance Center. 
The possible reasons for this behavior are:

  • Version conflict between controller and Load Injector.
  • Map file was missing on one of the load generators.
  • Analysis of the load test run showed that the load test had exceeded its timeslot and ended with the error "Executing run failed to stop in a timely manner". Furthermore no load test results were collated for this load test. As a consequence test result collation was perfomed manually by setting the collator status to "before collating results" and then collating the results.
Solution:
Install correct version of Load generator on all the LG machines.

In order to resolve this problem, where no map file is used and all information is written to the eve file, revert to the old way of writing the results using this steps:
a) Close all the instances of Controller and make sure no test is running.
b) On the Controller machine search and find the file "Wlrun7.ini".
c) Back up the file to save the original version
d) On the file go to [GENERAL] section and add the line: EveVersion=2, close and save the changes.
e) Launch the controller and run the LoadTest. If this is controller machine in Performance Center implementation, perform this operation on every controller machine that is running a load test.
f) Open the results with analysis and all the transactions should be present.

This problem is fully resolved in LoadRunner 11 and Performance Center 11, as information to the MAP file is written during the load test itself and not only at the end of the load tests

Alternate Workaround:

Try the following workaround so that Analysis will display names under transaction names rather than numbers in the Analysis Report.
1. Open a new analysis session and change the option there  in Tools ---> Options ---> Result collection --->Choose "Generate summary data only."
The default is "Display summary while generating complete data."
 
2. Then, go to File ---> Open ----> Change the "Type of File"  to "LoadRunner Results."  The default is "Analysis Session Files."
 Choose the .lrr file and Click on "Open". 
3. The Analysis report will be generated.  Save the .lra file.
Open the .lra file and check the Summary report for transaction names.



Error:Unable to create Java VM" when running / recording a Java Vuser

Problem Statement:
When trying to run (or record with) a Java Virtual User (or java record and replay), the following error message occured:
"Error -22994 : Error:Unable to create Java VM. [MsgId: MERR-22994]


Resolution:
Check the Java add-in and the System variables Path and Classpath
1. This error usually means that the PATH and the CLASSPATH environment variables are not set properly. (Check whether any other tools like QTP or Winrunner is not installed on the system previously, as it sets its own custom variables related to java hook and path)
2. Delete ini file for Vugen:
a. Shutdown Vugen.
b. Go to (Window install directory) and look for vugen.ini. Delete the file. LoadRunner will recreate new configuration file when VuGen is launched.

c. Launch VuGen and run the script again. 

"java.security.AccessControlException..." during replay

Problem Statement:
The (java / java record n replay) script was recorded without any problems. During replay, the user receives the error:


System.out: Exception occured: java.security.AccessControlException: access denied(java.lang.RuntimePermission createClassLoader )
Notify: System.err: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader )
Error System.err: at java.security.AccessControlContext.checkPermission(AccessControlContext.java:xx)
Error System.err: at java.security.AccessController.checkPermission(AccessController.java:xx)
Error System.err: at java.lang.SecurityManager.checkPermission(SecurityManager.java:xx)
Error System.err: at java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:xx)
Error System.err: at java.lang.ClassLoader.(ClassLoader.java:xx)
Error System.err: at DummyClassLoader.(DummyClassLoader.java:xx)
Error System.err: at DummyClassLoader.setContextClassLoader(DummyClassLoader.java:xx)
Error System.err: at Actions.action(Actions.java:xx)
Error Error occured: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader )  



Resolution:


Comment out the section for "Installing RMISecurityManager."
Example:
/* if (System.getSecurityManager() == null)
System.setSecurityManager(new java.rmi.RMISecurityManager()); */ 


How to call a custom C# dll in VUGen

It’s not possible to directly call a C#.Net code in LR; for that you need to create a wrapper dll around the original dll. Below is a sample example and ways to do it:


If your core code implementation looks like below:
*********************************************************************
using System;
namespace intmath
{
public class Class1
{
public Class1()
{
}


public static int sum(int a, int b)
{
return (a+b);
}

}

}


*********************************************************************
And this code creates a dll called as “intmath.dll” which is in c# code.

1.Launch Visual Studio .NET and create a new C++ Win32 Project. In the application settings, set the application type to "Dll."
2. Set all required configuration properties required for using managed extensions in the project properties.
a.Go to Configuration Properties -> General.
b.Set the "Use Managed Extensions" option to Yes.
c.Go to the properties of the .cpp file, and under Configuration Properties -> C/C++ -> Pre-Compiled headers, set the "Create/Use Precompiled Header" option to "Not Using Precompiled Headers."

3. Add a reference to the managed code library in this project. //In this case it will be “intmath.dll”


4. In the projects .cpp file, add methods to make calls to the managed code. Add code in the beginning to include the appropriate namespaces.


Below is a code snippet of the cpp file


*************************************************************************
#using

using namespace System;
using namespace intmath; // This is the namespace which is of your original file

#include "stdafx.h"


BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern int Calladd(int, int);


extern "C"
{
__declspec(dllexport) int add(int a, int b)
{
return Calladd(a,b);
}


}


int Calladd(int a, int b){
return Class1::sum(a,b); // call to the original function written in C#
}


***************************************************************************
build this project and generate your dll, in this case it will be known as “mytest.dll” (name of your project)

Then I can use this dll in my VUGen script like shown below:
****************************************************************************


Action()
{

lr_load_dll("mytest.dll"); // Instead of loading the original “intmath.dll”
lr_output_message("add(12, 13) = %d", add(12, 13));
return 0;


}

*******************************************************************************

Hope this will help you in resolving issue with dll loading.