Friday, March 13, 2009

How to convert a C-Web Vuser script to a Java Vuser script

Converting a C Vuser to a Java Vuser requires sed.exe and lrconvertweb.sed

For LoadRunner 8.0 and above
1. Record your Web Vuser using standard HTML/HTTP recording.

    Note:
    a. Be aware that Java Vusers use different parameter braces; Web uses "{ }" and Java Vusers use "<>," which can cause some problems with converted users. Edit the script or the options appropriately.
    b. Make sure that the Java environment is setup properly by running an empty Java Script first.
2. Replay your Web Vuser. When it replays correctly, cut and paste the entire script into a text document.
    Example:
    C:\temp\web.txt

    Note: There is a known limitation on the number of lines the sed utility can process. If you have a large file, break down the script to smaller chucks, with 1000 lines each. Then, convert each of the segments to Java

3. Make sure that \bin is in your system's PATH enviroment. Then open command line and switch to \dat directory. Enter the following command:
    sed -f web_to_java.sed [script_file] > [destination]

    Example:
    sed -f web_to_java.sed c:\temp\web.txt > c:\temp\java.txt

4. Open the C:\temp\java.txt file, and copy the entire contents into your Java Vuser's Action section when it is appropriate for your application. If you are placing the generated Web Java script into a Java-Template user, you will need to Modify the public int action() line to look like public int action() throws Throwable, otherwise the user may not run. Recorded Java users (i.e., RMI/Corba) should already have this change.

5. You should now be able to parameterize the script and use it to correlate with the combined Java Vuser.

6. After converting the script to Java, you may need to set some Web related Run-Time Setting. Since 'Internet Protocol' section is missing in Java-Related template, you can do the following to add the Run-Time Settings:
a. Close VuGen
b. Navigate to the c. Edit the relavant .lrp (General-Java.lrp for Java template) file using a word editor.
d. Locate the [Vugen] section.
e. For the data for CFG_TAB_DLL=, add a comma (,) and add LRWRunTimeSettingsUI.dll to it.


No comments:

Post a Comment