Sunday, February 25, 2024

How to call a custom C# dll in VUGen | Calling Custom C# DLLs in VuGen

Sample Blog Post

How to Call a Custom C# DLL in VuGen

Step 1: Create a Custom C# DLL

using System;

namespace CustomFunctions
{
    public class CustomFunctions
    {
        public static string HelloWorld()
        {
            return "Hello, World!";
        }
    }
}

Step 2: Prepare VuGen Environment

Place the generated DLL file in a location accessible by VuGen.

Step 3: Call the Custom DLL in VuGen

extern "C" int lr_load_dll(const char *lpLibFileName);

extern "C" void HelloWorld();

Action()
{
    lr_load_dll("path_to_dll\\CustomFunctions.dll");

    HelloWorld();

    return 0;
}

Example

#include "lrun.h"

extern "C" int lr_load_dll(const char *lpLibFileName);

extern "C" void HelloWorld();

Action()
{
    lr_load_dll("path_to_dll\\CustomFunctions.dll");

    HelloWorld();

    return 0;
}

Syntax

Declaration in C#

using System;

namespace CustomFunctions
{
    public class CustomFunctions
    {
        public static string HelloWorld()
        {
            return "Hello, World!";
        }
    }
}

Declaration in VuGen (C)

extern "C" int lr_load_dll(const char *lpLibFileName);

extern "C" void HelloWorld();

Loading DLL and Calling Function in VuGen (C)

lr_load_dll("path_to_dll\\CustomFunctions.dll");

HelloWorld();

Saturday, February 24, 2024

Error -27796: Failed to connect to server "XXXXXXXXXX.XXXX:443": [10060] Connection timed out "

Error -27796 in LoadRunner indicates a failure to connect to the server within the specified timeout period. This can happen due to various reasons, including network issues, server unavailability, firewall restrictions, or incorrect server configurations. Here are some steps you can take to troubleshoot and resolve this issue:

// Set the SSL/TLS version to TLS 1.2 web_set_sockets_option("SSL_VERSION", "TLS1.2"); // Set HTTP-request connect timeout (sec) in Run Time Settings web_set_timeout(CONNECT, "300"); // Set Connect time-out value to 1600 or more at the beginning of the Action section web_set_timeout("1600");