Compiling Extension Scripts and Configuring LoadRunner

Create compiled LoadRunner files from your parameterized scripts, and configure LoadRunner to run the scripts.

  1. Create empty C# script files, using these parameters:
    1. Configure the Virtual User Generator to use the Microsoft .NET protocol and the default C# language option.
    2. Do not start recording: you will use the extension-generated recording instead.
    In the output folder, LoadRunner generates stub C# source files for vuser_init.cs, Action.cs, and vuser_end.cs. It also generates a C# project file, Script.csproj.
  2. From your extension output folder, copy the C# script files that you generated using the extension, and paste them into the location of the empty LoadRunner-generated files that you generated in step 1.
    This overwrites the empty stub files.
  3. Edit the copied extension script files as required, including your parameterization.
  4. If you are redeploying a Hybrid App, verify that the generated ID and version are still correct.
    The generated vuser_init.cs includes the ID and version from the XML recording. For example:
    hwc.ModuleId = 1;
    hwc.ModuleVersion = 2;

    When you deploy the Hybrid App, the server assigns a module ID and version number, which at runtime should match the values in the generated file. However, the server might not assign the same values each time, even if you have not changed the application.

    1. In SMP_HOME\Servers\MessagingServer\Bin\Mobile Workflow, note the ID and version number for the redeployed Hybrid App.
    2. Compare these values to the ID and version number in the vuser_init.cs file. If the values are different, correct the values in vuser_init.cs.
  5. In the LoadRunner-generated C# project, add a reference to SMP_HOME\Servers\UnwiredServer\LoadRunnerAPI\lib\SAP.Mobile.LoadRunner.dll.
    A convenient method is to open Script.csproj in Visual Studio, add the reference there, then save the project and exit Visual Studio.
    Note: If you generate Script.csproj using LoadRunner 11.0, then open Script.csproj using Visual Studio 2008 or later, Visual Studio upgrades your C# project. The LoadRunner 11.0 Virtual User Generator and Controller cannot build the upgraded project, because LoadRunner invokes an incompatible version (2.0) of the msbuild tool.

    To work around this problem, edit the Script.sln file, and change the Format Version from 10.00 to 9.00. The problem does not occur if you use LoadRunner 11.5.

  6. Compile the script in Virtual User Generator.
  7. In Virtual User Generator, open Run-time Settings. In the Miscellaneous section under Multithreading, choose Run Vuser as a process.
    The default Run Vuser as a process option is not supported.
  8. Copy the DLL files from SMP_HOME\MobileSDKversion\Win32 to the bin subfolder of your LoadRunner script directory.
    These DLLs are required at runtime to execute LoadRunner extension scripts.