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

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

问题描述

重要的最佳做法,以不使用View Results Tree

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

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.

但是View Results Tree是调试脚本以识别脚本中问题的绝佳工具.

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来忽略采样器结果方法,甚至通过在属性中将线程数设置为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)

推荐答案

我会说,目前

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();

  • 使用金牛座工具来运行您的测试,它具有对现有脚本的修改功能这样您就可以使用简单的声明性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天全站免登陆