DEV Community

Jagadish Rajasekar
Jagadish Rajasekar

Posted on

LoadRunner – Interview Refresher (with Scripting & C Questions)

When LoadRunner comes up in interviews, you’re usually tested on practical usage, correlation, analysis, scripting, and C programming fundamentals.

This post is a refresher to quickly recall what you need before an interview.

👉 If you want a fundamentals walkthrough first, here’s a good YouTube intro:

🎥 LoadRunner Tutorial for Beginners – Guru99


1. LoadRunner Architecture

  • VuGen (Virtual User Generator) → create scripts.
  • Controller → design scenarios, run load.
  • Load Generators → simulate virtual users.
  • Analysis → interpret test results.

💡 Interview Angle:

“How is LoadRunner structured?”

→ VuGen (scripts), Controller (orchestrates), LGs (execute), Analysis (results).


2. Protocols

  • Web (HTTP/HTTPS), TruClient, SAP, Citrix, Oracle, etc.
  • Protocol choice is crucial → wrong protocol = incomplete script.

💡 Interview Angle:

“Why is protocol selection important?”

→ It determines how traffic is captured.


3. Correlation

  • Capturing dynamic values (session IDs, tokens).
  • Done with Correlation Rules or web_reg_save_param.
web_reg_save_param("SessionID", "LB=sessionId=", "RB=;", LAST);
Enter fullscreen mode Exit fullscreen mode


`

💡 Interview Angle:
“How do you handle dynamic values?”
→ Use correlation to capture → save → reuse in later requests.


4. Parameterization

  • Feeds different test data for each user.
  • Sources: file, table, random, sequential, unique.

💡 Interview Angle:
“What is parameterization?”
→ Feeding external test data so each Vuser has unique input.


5. Transactions & Think Time

  • Transactions measure response times:

c
lr_start_transaction("Login");
web_url("LoginRequest", ...);
lr_end_transaction("Login", LR_AUTO);

  • Think Time simulates real user delays:

c
lr_think_time(5); // 5 second pause

💡 Interview Angle:
“Why use transactions?”
→ To measure performance of business flows.


6. Runtime Settings & Scenarios

  • Pacing → controls iteration frequency.
  • Goal-Oriented vs Manual Scenarios in Controller.
  • Ramp-up, ramp-down, LG distribution.

💡 Interview Angle:
“How do you simulate 10,000 users?”
→ Distribute across multiple LGs, ramp gradually, monitor infra.


7. Analysis & Metrics

  • Key metrics: Avg response time, throughput, hits/sec, error %, pass/fail.
  • Always correlate with server metrics (CPU, memory, DB, network).

💡 Interview Angle:
“What reports matter most?”
→ Transaction response times + throughput + error % correlated with infra.


8. LoadRunner vs JMeter

  • Strengths: Multiple protocol support (SAP, Citrix, legacy apps).
  • Weaknesses: Expensive license, heavy setup.
  • JMeter better for web apps + CI/CD.

💡 Interview Angle:
“When to choose LoadRunner over JMeter?”
→ LoadRunner for enterprise protocol coverage, JMeter for cloud + open source.


9. Scripting-Specific Questions

Correlation Functions

c
web_reg_save_param("SessionID", "LB=sessionId=", "RB=;", LAST);

💡 Expectation: You know how to place correlation before the request.


Parameterization

c
char *user = lr_eval_string("{Username}");
char *pass = lr_eval_string("{Password}");


Transactions

c
lr_start_transaction("Login");
web_url("LoginRequest", ...);
lr_end_transaction("Login", LR_AUTO);


Think Time

c
lr_think_time(3);


10. Unique C Programming Questions in LoadRunner

Dynamic Strings

Q: Why use char[] in VuGen instead of string?
A: Because LoadRunner uses C, where strings are null-terminated arrays.

c
char url[200];
sprintf(url, "https://example.com/user/%s", lr_eval_string("{UserID}"));


lr_eval_string

Q: What does it return?
A: A char * pointer with {param} replaced by actual values.


Memory Management

Q: Why avoid large arrays in scripts?
A: Each Vuser runs its own copy → large arrays cause memory bloat.


Random Numbers

c
srand(time(NULL) + atoi(lr_eval_string("{vuser_id}")));
int rnd = rand() % 1000;

👉 Ensures unique random data across Vusers.


File Handling

c
FILE *f = fopen("data.txt", "r");
char line[100];
if (f != NULL) {
fgets(line, sizeof(line), f);
lr_output_message("Read: %s", line);
fclose(f);
}


String Tokenization

c
char response[] = "val1,val2,val3";
char *token = strtok(response, ",");
while (token != NULL) {
lr_output_message("Token: %s", token);
token = strtok(NULL, ",");
}


Error Handling

c
int rc = web_url("MyCall", ...);
if (rc != 0) {
lr_error_message("Request failed with rc=%d", rc);
}


Functions

c
int doLogin() {
lr_start_transaction("Login");
web_url("Login", ...);
lr_end_transaction("Login", LR_AUTO);
return 0;
}


Edge Case

Q: What happens if you forget \0 at the end of a string?
A: Undefined behavior → script may crash or print garbage.


✅ Key Takeaway

For LoadRunner interviews, focus on:

  • Architecture (VuGen, Controller, LG, Analysis)
  • Correlation & Parameterization
  • Transactions & Think Time
  • Scenario Design & Analysis Metrics
  • Scripting APIs (lr_eval_string, web_reg_save_param, etc.)
  • C Programming Basics (strings, loops, random, file handling, error checks)

Top comments (0)