Test Fragment

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
  1. 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?
  2. 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.
  3. Scripting based on the JMeter Test Fragment module:
  4. 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.
  5. Module-1
    1. Launch Home Page
    2. User Sign-up
    3. User Verification/Activation
    4. User Login
  6. Module-2
    1. Go To the Search Page
    2. Search a Product
    3. View full detail of a product
    4. Product  – Add to cart
    5. Fill Order form
    6. Fill payment details
    7. Place Order
  7. Module-3
    1. Update Order
    2. Re-submit Order
    3. Rate the product

Add a test fragment to the test plan by performing the following actions after breaking the flow into modules:

  1. Right-click on ‘Test Plan’
  2. Hover the mouse on ‘Add’
  3. Hover the mouse on ‘Test Fragment’
  4. Click ‘Test Fragment’
Scroll to Top