简体   繁体   中英

JMeter - Ignore View Results Tree Listener only in non GUI

Important best practice in not to use 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.

Or any listeners:

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.

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

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?

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

EDIT

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM