Apache JMeter : Add random data in body for request

前端 未结 3 642
旧巷少年郎
旧巷少年郎 2021-02-15 00:39

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:56
    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 00:56

    My example with __UUID

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

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

    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)
提交回复
热议问题