Today, we use Baidu search to do a single-scenario example of performance index testing. The test data is extracted from files in Excel (CSV) and XML formats. The test files used in this article can be downloaded from here.

  • Create an Excel file, enter the following data, and save it as a CSV file;

    name use
    selenium Website automation testing
    appium APP automated testing
    jmeter Performance Testing

    image.png

  • Create an XML file, enter the following data, and save it as a file with a .xml suffix;

     <?xml version="1.0" encoding="UTF-8"?>
    <tools>
        <tool name="qtp" />
        <tool name="rtf" />
        <tool name="loadrunner" />
    </tools>
  • Create a new JMeter Test Plan;
  • Create a new thread group named Data From CSV ;

    • Insert a CSV Data Set Config ;
    • Filename points to the file to read data, ~/jmeter/keywords.csv
      image.png
    • Insert a BeanShell Sampler* and enter the following in the script;
      image.png
    • Insert a Debug Sampler, keep the default without any modification;
      image.png
    • Insert an Http Request named Search Request ;
    • Enter http and www.baidu.com for protocol and service respectively;
    • Request type select get ;
    • Add a parameter, name and value are p2 , ${name} respectively;
      image.png
    • Insert a View Result Tree.
      image.png
  • Create a new thread group named Data From XML ;

    • Insert an Http Request named Search Request ;
    • Enter http and www.baidu.com for protocol and service respectively;
    • Request type select get ;
    • Add a parameter, name and value are p2 , ${__XPath(~/jmeter/keywords.xml, /tools/tool/@name)} ;
      image.png
    • Insert a View Result Tree.
      image.png
  • save and run the test plan;
  • Enter the View Result Tree nodes of the two thread groups respectively to view the execution results;
    image.png
  • Pay attention to the keywords in the Baidu search request and confirm that they have been correctly initialized before continuing;
  • Add a summary report to the first thread group;
  • Add an Aggregate Report to the second thread group;
  • run the entire test plan again;
  • View the average, maximum, response time and other response time data in the Summary Report;
    image.png
  • View median and percentile response time data in the Aggregate Report, along with error rates and more.
    image.png

Thematic catalogue


陈哥聊测试
158 声望3.3k 粉丝

资深敏捷测试顾问,国内知名项目管理软件禅道团队成员。