Include controller of JMeter is really useful if you lot wants to suspension your bear witness conception inwards small-scale fragments. There are many dissimilar jmeter controllers available. Each of them conduct keep dissimilar role equally per it's name. Include controller is useful to include external bear witness fragment inwards your test. Means you lot tin sack include external bear witness fragment inwards your software charge bear witness conception using include controller.
Let's conduct keep elementary example. You conduct keep v dissimilar charge bear witness scenario for your software spider web application as well as each needs login to software spider web application to perform adjacent steps. That way you lot hollo for to tape login steps inwards all v scenario's charge bear witness plan. So you lot are duplicating the mutual procedure steps inwards each bear witness conception as well as it volition increase bear witness conception maintenance terms too. Include controller tin sack assistance you lot inwards this situation.
Include controller provides you lot facility to job external bear witness fragment inwards your bear witness plan. So you lot conduct keep to relieve login steps equally a bear witness fragment as well as and thence you lot tin sack job that bear witness fragment inwards your all software charge bear witness plans using Include Controller. Let's empathize amongst practical example.
I conduct keep iv dissimilar requests equally bellow.
- Login
- My Account
- My Orders
- My Address
This is 1 scenario of my software spider web application's charge bear witness conception as well as at that topographic point are to a greater extent than iv such scenarios where Login asking is required. So I volition relieve Login asking equally bear witness fragment equally shown inwards bellow given steps as well as and thence i volition job that bear witness fragment inwards my dissimilar tests to login.
- Put Login asking nether Simple Controller.
- Right click on Simple Controller
- Select "Save equally Test Fragment".
- Give your desired refer to bear witness fragment as well as relieve it at your desired location. I conduct keep saved it amongst "Login module.jmx" at E:\JMeter\ path.
- Add Thread Group nether Test Plan(Right click on Test Plan -> Add -> Threads -> Thread Group).
- Add Include Controller under Thread Group(Right click on Thread Group -> Add -> Logic Controller -> Include Controller).
- In Include controller, Select "Login module.jmx" from E:\JMeter\ equally Filename using browse push equally shown inwards bellow image.
- Add elementary controller under Thread Group as well as add/record My Account, My Orders and My Address requests nether it equally shown inwards bellow image.
- Also add View Results Tree listener under Thread Group.
You tin sack download "Login module.jmx" as well as bear witness conception for Include Controller from THIS PAGE.
Now if you lot run to a higher house bear witness conception using Number of Threads = 1 as well as Loop count = 1 inwards Thread Group,
Now if you lot run to a higher house bear witness conception using Number of Threads = 1 as well as Loop count = 1 inwards Thread Group,
- First it volition execute Test Fragment(Which contains login request) of Include Controller and
- Then it volition execute requests(My Account, My Orders and My Address requests) of elementary controller equally shown inwards bellow given image.
Same way, You tin sack job "Login module.jmx" inwards all other jmeter software charge bear witness plans where login is required.
This way, Include controller allows you lot to suspension your bear witness conception to reuse it inwards other bear witness plans as well as cut down duplication of mutual steps. So it volition also cut down terms of bear witness conception maintenance.