Jmeter use of SHA1 encryption interface performance test

Performance testing, sometimes encounter needs to be encrypted authentication information header, the following I will introduce how SHA1 encryption for authentication developing performance test scripts
1, first understand the principle, SHA1 encryption is needed for the following three parameters , (appSecret + Nonce + curTime) , a string of three splicing parameters, for SHA1 hashing, converted to hexadecimal characters (string, lowercase)
2, CheckSum valid: for security reasons, each valid checkSum 5 minutes (with CurTime calculation), recommended that each request to generate a new checkSum, at the same time make sure that initiated the request server is synchronized with the standard time, such as a NTP service.
3, we need to do is to ask developers to get the SHA1 encryption function (java), then call BeanShell jmeter through, you can achieve this effect

First, add a thread group

  1. Add thread group, Jmeter execution is driven by a thread group, the test plan must have at least one thread group, select the Test Plan, right click, add "Threads" thread group
    Jmeter use of SHA1 encryption interface performance test

Second, add BeanShell Sample, HTTP requests

  1. Adding BeanShell request - select the thread group, right click, add "Sampler" BeanShell Sample
    Jmeter use of SHA1 encryption interface performance test
  2. BeanShell java statement to be called as follows, attention must first call the function here affirmed that the last call
    Jmeter use of SHA1 encryption interface performance test
    Jmeter use of SHA1 encryption interface performance test
  3. Adding HTTP request - select the thread group, right click, add "Sampler" HTTP request
    Jmeter use of SHA1 encryption interface performance test
  4. Enter the server IP, port, path parameter in the HTTP request
    Jmeter use of SHA1 encryption interface performance test
  5. Adding information in the HTTP request header, right-click HTTP request "Add" configuration element "HTTP header information manager, input AppKey, Nonce, CurTime, CheckSum, Content-Type
    Jmeter use of SHA1 encryption interface performance test
    Jmeter use of SHA1 encryption interface performance test
  6. In the HTTP request to add assertion, right-click HTTP request "Add" assertion "in response to the assertion, to assert the input field
    Jmeter use of SHA1 encryption interface performance test
    Jmeter use of SHA1 encryption interface performance test
  7. Add the result tree view, right-click the Thread Group "Add" listeners "see the results tree, used to view the test results
    Jmeter use of SHA1 encryption interface performance test

Third, the execution of the request

  1. Click the Start button on the page, you can see the script executed normally respond to normal results, this script development is complete, you can directly call the script for performance testing
    Jmeter use of SHA1 encryption interface performance test

   If the article helpful, I welcome attention to public numbers, the public numbers this article synchronized platform, facilitate access, I will continue to introduce articles related to testing, testing technology to share with you, each one original article is carefully written to you eliminate plagiarism copy


QQ technical exchange group: the group please enter this information 51cto
              Here Insert Picture Description


Micro-channel two-dimensional code number of public attention:

            Jmeter use of SHA1 encryption interface performance test


After concerns, respond resources to download, you can get my share of resources to download:

Jmeter use of SHA1 encryption interface performance test

Guess you like

Origin blog.51cto.com/6183574/2482441
Recommended