JMeter - 仅在非 GUI 中忽略查看结果树侦听器 [英] JMeter - Ignore View Results Tree Listener only in non GUI

查看:17
本文介绍了JMeter - 仅在非 GUI 中忽略查看结果树侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重要的最佳实践不使用查看结果树

不要在负载测试期间使用查看结果树"或在表中查看结果"侦听器,仅在脚本编写阶段使用它们来调试您的脚本.

Don't use "View Results Tree" or "View Results in Table" listeners during the load test, use them only during scripting phase to debug your scripts.

或任何听众:

尽可能少地使用监听器;如果使用上面的 -l 标志,它们都可以被删除或禁用.

Use as few Listeners as possible; if using the -l flag as above they can all be deleted or disabled.

但是查看结果树是一个很好的调试工具,用于识别脚本中的问题.

But View Results Tree is a great tool for debugging to identify issues in scripts.

我们可以仅在运行非 GUI 模式时以某种方式忽略它吗?

Can we somehow ignore it only when running a non GUI mode?

我可以通过 setIgnore 忽略采样器结果 方法,即使在属性中设置 Number of Threads 为 0 来忽略线程组,监听器是否可以被属性忽略?

I can ignore Sampler Result by setIgnore method, even ignore Thread Group by setting Number of Threads as 0 in property, can listener be ignored by property?

目前我在非 GUI 中运行之前/之后在 GUI 中手动启用/禁用.

Currently I manually enable/disable in GUI before/after running in non GUI.

编辑

但是 jmx 文件保存在版本控制中,所以它应该保持只读(用于 GUI 和非 GUI)

But jmx files are saved in version control, so it should remain read only (used both for GUI and non GUI)

推荐答案

我想说目前不可能使用 经典的非GUI模式测试执行,选项在:

I would say currently it is not possible with classic non-GUI mode of test execution, the options are in:

  1. 从测试计划中完全删除所有侦听器,并使用 结果文件配置属性
  2. 创建一个简单的 Java 包装程序来启动非 GUI JMeter 测试,该测试将在启动和禁用侦听器之前扫描测试计划.它会是这样的:

  1. Remove all the listeners from the test plan completely and control what is being stored in .jtl results file using Results File Configuration Properties
  2. Create a simple Java wrapper program to start a non-GUI JMeter test which will scan the Test Plan prior to starting and disable the listeners. It would be something like:

StandardJMeterEngine jmeter = new StandardJMeterEngine();
JMeterUtils.loadJMeterProperties("/path/to/your/jmeter.properties");
JMeterUtils.setJMeterHome("/path/to/your/jmeter");
JMeterUtils.initLocale();
SaveService.loadProperties();
HashTree testPlanTree = SaveService.loadTree(new File("/path/to/your/testplan"));
SearchByClass<ResultCollector> listenersSearch = new SearchByClass<>(ResultCollector.class);
testPlanTree.traverse(listenersSearch);
Collection<ResultCollector> listeners = listenersSearch.getSearchResults();
listeners.forEach(listener -> listener.setProperty(TestElement.ENABLED, false));
jmeter.configure(testPlanTree);
jmeter.run();

  • 使用 Taurus运行测试的工具,它具有现有脚本的修改功能因此您将能够使用简单的声明性 YAML 语法禁用侦听器:

  • Use Taurus tool to run your test, it has Modifications for Existing Scripts functionality so you will be able to disable listeners using simple declarative YAML syntax:

    ---
    execution:
      scenario:
        script: /path/to/your/testplan
        modifications:
          disable:  # Names of the tree elements to disable
          - View Results Tree
    

  • 这篇关于JMeter - 仅在非 GUI 中忽略查看结果树侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆