首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用taurus junit-xml模块时请求响应数据

使用taurus junit-xml模块时请求响应数据
EN

Stack Overflow用户
提问于 2020-08-19 01:37:24
回答 1查看 236关注 0票数 0

我正在尝试清理我们的功能测试的jmeter docker+ci管道。我看到taurus有一种干净的方式来在容器中运行jmeter脚本,它完成了下载我想要的jmeter版本+安装我的脚本使用的插件的繁重工作-非常好。

现在,我需要在junit.xml中生成报告,以便保持报告的一致性。到目前为止,我使用的是一个修改过的https://github.com/tguzik/m2u分支,用于将jtl报告转换为junit.xml。

感谢任何帮助,我可以获得请求,响应(代码和主体)的所有样本到junit.xml (至少对失败的样本)?

我试过几个金牛座yaml的变体。

代码语言:javascript
复制
reporting:
  - module: console
  - module: final_stats
    summary: true
    percentiles: true
    test-duration: true
  - module: junit-xml
    filename: report/report.xml
    data-source: sample-labels

代码语言:javascript
复制
reporting:
  - module: console
  - module: final_stats
    summary: true
    percentiles: true
    test-duration: true
  - module: passfail
  - module: junit-xml
    filename: report/report.xml
    data-source: pass-fail

此外,还在passfail模块上添加了特定的passfail标准变体。无济于事

在摆弄了几个小时之后,我相信没有一种简单的方法可以将任何有意义的东西从taurus中的junit - .xml模块转换成junit-xml报告。看起来是赤骨。我还注意到它可能会弄乱默认的jenkins junit插件测试结果摘要。

因此,我决定使用以下yaml设置,并继续使用m2u.jar将jtl转换为junit.xml。

代码语言:javascript
复制
    modules:
    jmeter:
      path: ~/.bzt/jmeter-taurus/bin/jmeter
      download-link: https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-{version}.zip
      version: 5.3  
      force-ctg: true 
      detect-plugins: true
      plugins:
      - jpgc-json=2.2
      - jmeter-ftp
      - jpgc-casutg
      xml-jtl-flags:
        xml: true
        fieldNames: true
        time: true
        timestamp: true
        latency: true
        connectTime: false
        success: true
        label: true
        code: true
        message: true
        threadName: true
        dataType: false
        encoding: false
        assertions: true
        subresults: true
        responseData: false
        samplerData: false
        responseHeaders: false
        requestHeaders: true
        responseDataOnError: true
        saveAssertionResultsFailureMessage: true
        bytes: true
        threadCounts: false
        url: true

execution:
- write-xml-jtl: full
  scenario:
    script: v_jmxfilename
    properties:
      environment: v_env

reporting:
  - module: console
  - module: final_stats
    summary: true
    percentiles: true
    test-duration: true
#  - module: junit-xml
#    filename: report/junit-report.xml
#    data-source: sample-labels
EN

回答 1

Stack Overflow用户

发布于 2020-08-20 00:31:17

根据目前的JUnit-XML-Reporter文档,这是不可能的:

本文以Jenkins JUnit插件可解析的JUnit XML格式提供测试结果。Reporter有两个选项:

  • filename (报表文件的完整路径,可选。默认情况下,工件标签中的xunit.xml (要使用的数据源: sample-labels或pass-fail)

如果样本标签用作源数据,报告将包含带有测试错误的urls。如果pass-fail用作源数据,报告将包含Pass/Fail标准信息。请注意,您必须将pass-fail模块放在reporters列表中的junit-xml模块之前。

金牛座不仅仅是针对JMeter的,它支持更多的工具,而且并不是所有的工具都提供了存储请求和响应数据的可能性,所以我能想到的选项有:

  1. Listener添加到您的《测试计划》中,并选择需要存储到单独文件中的指标,使用最简单的方法是使用ShellExec Service从Taurus config YAML运行您的m2u.jar
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63473866

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档