JMeter-Test Fragment
With the JMeter Test Snippet element, it is possible to set up a module-based workflow by writing a long flow script. Let’s use an illustration to try to understand this. Consider a transaction flow that has:
- Launch Home Page
- User Sign-up
- User Verification/Activation
- User Login
- Go To the Search Page
- Search a Product
- View full detail of a product
- Product – Add to cart
- Fill Order form
- Fill payment details
- Place Order
- Update Order
- Re-submit Order
- Rate the product
- For the flow mentioned above, only one JMeter script needs to be prepared. You have three team members and one day. The combined working bandwidth of the three sources must be used. How are you going to do it then?
- The ‘Test Fragment’ part is the response. JMeter scripts are often complicated by default! But you can take advantage of some great options. JMeter provides test chunking to reduce script code and make it easier to manage by splitting the stream into separate parts.
- Scripting based on the JMeter Test Fragment module:
- If more than one tester is required to work on different modules at the same time, and the modules can be included in a load test, a test snippet is a good solution. In the above example, if you split the transaction flow into manageable modules and divide each module among the three test team members, such as the user sign-in/login module, the ordering module, and the module update order, you can complete the task within the allotted time.
- Module-1
- Launch Home Page
- User Sign-up
- User Verification/Activation
- User Login
- Module-2
- Go To the Search Page
- Search a Product
- View full detail of a product
- Product – Add to cart
- Fill Order form
- Fill payment details
- Place Order
- Module-3
- Update Order
- Re-submit Order
- Rate the product
Add a test fragment to the test plan by performing the following actions after breaking the flow into modules:
- Right-click on ‘Test Plan’
- Hover the mouse on ‘Add’
- Hover the mouse on ‘Test Fragment’
- Click ‘Test Fragment’