EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials JMeter Tutorial JMeter While Controller
Secondary Sidebar
JMeter Tutorial
  • JMeter Basic and Advanced
    • What is Jmeter
    • Install Jmeter
    • JMeter API Testing
    • JMeter if controller
    • JMeter JSON Extractor
    • JMeter Recording
    • JMeter CSV Data Set Config
    • JMeter Command Line
    • JMeter Report
    • JMeter HTTP Request
    • JMeter While Controller
    • JMeter with Selenium
    • JMeter Script
    • JMeter Constant Throughput Timer
    • JMeter Random Variable
    • JMeter tool
    • JMeter BlazeMeter
    • JMeter Parameters
    • JMeter Plugins
    • JMeter Performance Testing
    • JMeter load testing
    • JMeter BeanShell
    • JMeter User-Defined Variables
    • JMeter WebSocket
    • JMeter Aggregate Report
    • JMeter Distributed Testing
    • JMeter Summary Report
    • JMeter Response Assertion
    • JMeter Assertion
    • JMeter Thread Group
    • JMeter Loop Count
    • JMeter Variables
    • JMeter Testing
    • JMeter Version
    • Timers in Jmeter
    • JMeter Alternatives
    • JMeter Command Line Options
    • JMeter Ramp Up Period
    • JMeter Plugin Manager
    • JMeter Throughput
    • JMeter Regular Expression Extractor

JMeter While Controller

JMeter While Controller

Introduction to JMeter While Controller

JMeter provides a different controller for the user to perform load and performance testing per our requirements. The whole is one of the controllers that the JMeter provides. While the controller is used to run the child samplers from the Test Plan, it continues the execution until the condition is false from the condition field. For example, suppose the condition field has a blank value at that time while the controller exits. Normally the while controller is a conditional statement, and it allows us to implement some advanced scenario that means some condition depends on the other scripts.

What is JMeter while controller?

Regarding building a high-level JMeter load test situation that accepts complex rationale, contingent upon specific conditions, it is sometimes expected to change the Sampler’s execution request. Typically JMeter runs every one of the Samplers topsy turvy, yet there could be a few situations when the default conduct isn’t reasonable.

JMeter’s execution of the while controller. For those inexperienced with the whole controller idea, to lay it out plainly, it’s simply a rehashed “if->then” articulation.

In the case something is valid, then, at that point, rehash the last activity

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

In JMeter, the regulator fundamentally runs kids Samplers, except if some foreordained “Condition” is “valid” where “Condition” could be:

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,560 ratings)

Clear: for this situation, the While Controller will leave when the last sampler insider savvy falls flat

LAST: equivalent to clear, yet with an extra check for the last Sampler before the controller result. If the previous Sampler isn’t effective, the While Controller and its youngsters will not be executed.

Function or Variable JMeter: The Controller’s kids will run until a variable or capacity assessment result is “valid.”

Property of JMeter: equivalent to Function or Variable, yet expects the Property all things being equal

Both the Function/Variable and Property approaches expect that the “Condition” will be set to “bogus” someplace in or outside the controller. On account of Property, it very well may be done from another Thread Group or even external JMeter.

The initial 2 cases with “clear” and “LAST” are straightforward. Assuming you leave the “Condition” clear or set it to LAST, the controller will break if the last sampler under the While Controller isn’t fruitful. Similar applies to the Variables and Properties. The While Controller will control its youngsters until the Variable or Property determined in “Condition” will bring about “validity.”

How to use JMeter while controller?

Now let’s see how we can use the while controller in JMeter.

We know that while the controller runs the child until the condition is false.

First, we need to consider some possible conditions as follows.

Blank: Blank means it exits the loop when the last sample fails.

Last: means it exits the loop when the last sample fails.

Condition

The condition means variable or function, and while the controller requires true or false, that means, as per our requirement, we can set the condition.

First, create the Test Plan as per our requirement; here, we created the Test Plan as shown in the following screenshot.

JMeter While Controller output 1

Now add the Thread Group and sampler; here, we add the HTTP request sample as shown in the following screenshot.

JMeter While Controller output 2

Here we add a dummy API with a view result tree, as shown in the following screenshot.

JMeter While Controller output 3

As shown in the following condition, we must add the condition to implement the while controller.

JMeter While Controller output 4

First, while the controller, we can check with blank as shown in the following screenshot.

output 5

After executing the Test Plan, we can view the output in the view result tree, as shown in the following screenshot.

output 6

Now set the same condition as per our requirement; here, we set the counter value as follows.

${__javaScript(parseInt(vars.get(“counter”))<=50)}

After execution, we can set the result in the following screenshot.

output 7

output 8

Here we can access the dummy URL from the CSV file, which can be accessed through the variables.

JMeter while controller Functions

Now let’s see while the controller functions as follows.

We know JMeter provides the different types of inbuilt functions for the user to implement, while controller is as follows.

  1. Information

Under the information type, JMeter provides the different functions as follows.

  • thradNum: If we want to get the thread number, then we can use this number.
  • samplerName: It is used to get the name of a sampler.
  • Time: It returns the system’s current date per our required format.

As well as information type provides the log, logn, machinelp, and machineName functions.

  1. Input

Under the input type, JMeter provides different functions as follows.

  • StringFromFile: It is used to read the text from the file.
  • FileToString: If we require reading the entire file, we can use this function.
  • XPath: It is used to read the XPath expression from a file.
  • CSDVRead: It is used to read the CSV file.
  1. Calculation

Under calculation, JMeter provides the different types of functions as follows.

  • Counter: If we want to increment the number at that time, we can use this function.
  • intSum: It is used to add the integer to the number.
  • longSum: It is used to add the long integer number.
  • Random: By using this function, we can generate a random number.
  • RandomSring: By using this function, we can generate the random string.
  1. Scripting

Under scripting, JMeter provides the different types of functions as follows.

  • BeanShell: It is used to run the BeanShell script.
  • JavaScript: By using this function, we can work on JavaScript.

These are some sample types, and their function and JMeter also provide some additional functions such as Properties, Variables, String, etc.

JMeter while controller Cases

Now let’s see different cases for the while controller as follows.

  • While with counter: We can use a while controller to combine with a counter.
  • Sampler of Beanshell: Here, we can declare counter value 1.
  • While controller: We can check the counter value using the while controller.
  • Processor: It is used to increment the counter value.

Conclusion

We hope from this article you learn more about JMeter while controller.  From the above article, we have taken in the essential idea of JMeter while controller, and we also see the representation and example of the JMeter while controller. Furthermore, this article taught us how and when to use the JMeter while controller.

Recommended Articles

This is a guide to JMeter While Controller. Here we discuss the essential idea of JMeter while controller, and we also see the representation. You may also look at the following articles to learn more –

  1. Timers in JMeter
  2. What is JMeter?
  3. JMeter Interview Questions
  4. Manual Testing Tools
Popular Course in this category
JMeter Testing Training (3 Courses)
  3 Online Courses |  9+ Hours |  Verifiable Certificate of Completion |  Lifetime Access
4.5
Price

View Course
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more