Apache JMeter : Add random data in body for request

前端 未结 3 1075
心在旅途
心在旅途 2021-02-15 00:33

I\'m working on stress testing our application in Apache JMeter.

I thought of calling register user method which will add users in the database. But if the email already

相关标签:
3条回答
  • 2021-02-15 00:58

    Take a look at JMeter Functions like:

    • __Random() - which generates a random number in the given range
    • __RandomString() - which generates a random string from the given input
    • __threadNum() - which returns the current thread number
    • __UUID() - which returns an unique GUID structure
    • __time() - which returns current time stamp in different formats
    • any combination of above

    JMeter functions can be used anywhere in the test so you can put them directly into your request body.

    Some more recommendations:

    • Don't use JMeter GUI for running the load test, GUI mode is designed for tests development and debugging only, the tests themselves need to be run in command-line non-GUI mode
    • Remove all the listeners from the test plan while running your load test as JMeter listeners are very resource intensive and create unnecessary overhead.
    0 讨论(0)
  • 2021-02-15 01:03
    1. Use Random Variable with variable name emailValue and send ${emailValue} in request

    2. Use JDBC request to your database to create random number or sequence and save in variable name emailValue

    3. Use UUID function to create uniqueId and send in email ${uniqueId}@gmail.com for example

    0 讨论(0)
  • 2021-02-15 01:11

    My example with __UUID

    For POST request, make sure you have correct Content-Type in HTTP Header Manger , application/json for example.

    0 讨论(0)
提交回复
热议问题