Module and Include Controllers in JMeter

The goal of the Module Controller is to add modularity to JMeter. The general idea is that web applications consist of small units of functionality (i.e. Login, Search Product, Order Product). This functionality can be stored in Simple Controller as modules. Module Controller will choose which module needs to run.

The Following Example Demonstrates the Module controller

  • Open the JMeter in your system.
  • Add Thread Group(Right-click on Test Plan-->Add--Threads-->Thread Group) to the Test Plan and name the Thread Group as Thread Group1.
  • Next, add HTTP Sampler request and then enter the in the server IP. Here I am changing the request name as login.
  • Add one more HTTP Request and then enter the as Server IP and then name the Request as Search_Product.
  • Next, add one Thread Group to the Test Plan and then name it as Thread Group2
  • Add HTTP Request and then enter the in the Server IP. Change the Name of the Request as Order_Product.
  • Next, add Test Fragment to the Thread Group and then move login request to the Test Fragment(Right-click on Test Plan-->Add-->Test Fragment-->Test Fragment)
  • Moving the login request to Test Fragment.
  • We are going to execute a test plan which contains two thread groups and the Thread Group1 contains:
    • login request and Search_Product request.
  • And in the Thread Group2 contains login and Order_Product requests.
  • I have added one Test Fragment to the Test Plan and I have added login request to the Test Fragment instead of keeping it in both the thread groups.
  • So overall we have two modules one is Search_Product and Order_Product, but in both cases the login is mandatory.
  • By adding Module Controller to both the Thread Groups I ma going yo execute both modules with Login request as well.
  • Right-click on Thread Group1-->Add-->Logic Controller-->Module Controller
  • Right-click on Thread Group2-->Add-->Logic Controller-->Module Controller and then click on the Each Module Controller and select Test Fragment
  • Add View Result Tree to the Test Plan and then save and run the Test Plan.
  • So for each Module, the login request has been executed (Search_Product and Order_Product)

Include Controller in JMeter

Include controller of JMeter is very useful if you want to break your test plan in small fragments. There are many different jmeter controllers available. Each of them has a different purpose as per its name.

Include controller is useful to include external test fragments in your test. Means you can include external test fragment in your software load test plan using include controller.

Include controller provides you the facility to use external test fragments in your test plan. So you have to save login steps as a test fragment and then you can use that test fragment in your all software load test plans using Include Controller. Let's understand with practical examples.

The Following Example Demonstrates the Include Controller

  • Open the JMeter and then open the Module Controller.jmx test plan.
  • Which is having two Thread Groups and Test Fragment.
  • So, Add one more thread group and name it as Thread Group3 and then move the Search_Product and Order_Product request to the Thread Group3.
  • Right-click on the Thread Group3 and add Include Controller
  • Double click on the Test Fragment and then right-click on the Login and select save as test Fragment.
  • And then save the file in your bin folder.
    save-login-as test-fragment-jmeter
  • Now, right-click on the Thread Group3 and then add Include Controller.
  • Open the Include Controller and then click on the Browse and then add the login test fragment.
  • Disable the Thread Group1 and Thread Group2 and then save and run the Test Plan.
  • After the Execution, the Include controller will take the loginTest Fragment and execute the Login Request and then execute the Search_Product and Order_Product.

0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions