0

我想在 jmeter 的 excel 文件中打印通过和失败计数,例如:

需求图片

4

1 回答 1

1

The closest way is:

  1. Run your JMeter test in command-line non-gui mode like

    jmeter -n -t test.jmx -l result.jtl
    
  2. Generate HTML Reporting Dashboard from the file like:

    jmeter -g result.jtl -o dashboard
    

    it will produce dashboard folder in "bin" directory of your JMeter installation where you will be able to find index.html file containing the results metrics:

    enter image description here

  3. If it is not enough - there is statistics.json file under the dashboard folder which looks like:

    {
      "API2": {
        "transaction": "API2",
        "sampleCount": 25,
        "errorCount": 7,
        "errorPct": 28.0,
        "meanResTime": 291.12000000000006,
        "minResTime": 63.0,
        "maxResTime": 467.0,
        "pct1ResTime": 462.8,
        "pct2ResTime": 466.1,
        "pct3ResTime": 467.0,
        "throughput": 5.869922517022775,
        "receivedKBytesPerSec": 0.6534874677154261,
        "sentKBytesPerSec": 0.0
      },
      "Total": {
        "transaction": "Total",
        "sampleCount": 75,
        "errorCount": 18,
        "errorPct": 24.0,
        "meanResTime": 274.88000000000005,
        "minResTime": 53.0,
        "maxResTime": 494.0,
        "pct1ResTime": 471.4000000000001,
        "pct2ResTime": 486.40000000000003,
        "pct3ResTime": 494.0,
        "throughput": 14.705882352941176,
        "receivedKBytesPerSec": 1.6371783088235294,
        "sentKBytesPerSec": 0.0
      },
      "API3": {
        "transaction": "API3",
        "sampleCount": 25,
        "errorCount": 3,
        "errorPct": 12.0,
        "meanResTime": 260.5999999999999,
        "minResTime": 72.0,
        "maxResTime": 492.0,
        "pct1ResTime": 479.2,
        "pct2ResTime": 488.7,
        "pct3ResTime": 492.0,
        "throughput": 5.847953216374268,
        "receivedKBytesPerSec": 0.6510416666666666,
        "sentKBytesPerSec": 0.0
      },
      "API1": {
        "transaction": "API1",
        "sampleCount": 25,
        "errorCount": 8,
        "errorPct": 32.0,
        "meanResTime": 272.9199999999999,
        "minResTime": 53.0,
        "maxResTime": 494.0,
        "pct1ResTime": 488.20000000000005,
        "pct2ResTime": 493.7,
        "pct3ResTime": 494.0,
        "throughput": 5.534646889528448,
        "receivedKBytesPerSec": 0.6161618607482842,
        "sentKBytesPerSec": 0.0
      }
    }
    

    which can be loaded in Excel and transformed according to your requirements

于 2019-10-08T10:07:02.827 回答