Flow Logic

Business flow logic

In some cases, you must create your own original code to handle user activity while you create the script. A hotel booking website can list all the hotels and indicate if they are booked or available. Based on the business case, a user should only select hotels with an occupancy status of “Available”. If you were to play the script using the recorded hotel that was booked during the recording, the script would try to do the same, but the server would reject it and throw an error. Finally, a message appears stating that the script failed. Now you need to create custom logic that only books available hotels after first checking the occupancy status of the hotel. By adding the appropriate business flow logic to the script, you perform flow debugging in this case.

To steer the flow of execution in the right direction, you must have a basic understanding of coding (such as the C language). Fundamental skills include mastering conditional and iteration statements, declaring variables, calling functions, etc. Let’s try to understand the main flow control clauses used by LoadRunner:

Conditional statements:

They compare the value of a variable with the specified condition and control the flow based on the result (True or False).

  • ‘if’ clause
  • If-else clause
  • ‘if-(else-if…..)’else’-clause

Iteration statements:

The iteration statement helps develop the logic required to iterate over a particular piece of code or request. ‘Loop’ is another name for this type of phrase. There are three basic loop statements in C, listed below. All three loop statements are supported by LoadRunner, which also helps create iterative logic in the test script.

  • “before” loop
  • “while loop”
  • “do-while loop”
Scroll to Top