Discussion:
Print thread groups including comments fields of underlying controllers
Mathijs Groen
2018-10-08 12:59:39 UTC
Permalink
I have following question. I use JMeter as a tool for testing our internal API’s, from a functional point-of-view.

I use the comment fields for functionally describing the tests. Is it possible to print out all (a selection of) tests (‘Include Controllers’) including the Comments field on paper / to PDF?
g***@live.com
2018-10-09 09:08:18 UTC
Permalink
You can use SearchByClass
<https://jmeter.apache.org/api/org/apache/jorphan/collections/SearchByClass.html>
functions in order to fetch information on Include Controllers from the Test
Plan.

Here is an example with regards to how this can be done from JMeter test
itself using JSR223 Sampler
<https://jmeter.apache.org/usermanual/component_reference.html#JSR223_Sampler>
and Groovy <https://www.blazemeter.com/blog/groovy-new-black> language :

1. Add tearDown Thread Group
<https://jmeter.apache.org/usermanual/component_reference.html#tearDown_Thread_Group>
to your Test plan
2. Add JSR223 Sampler to the tearDown Thread Group
import org.apache.jmeter.engine.StandardJMeterEngine
import org.apache.jmeter.control.IncludeController
import org.apache.jorphan.collections.HashTree
import org.apache.jorphan.collections.SearchByClass
import java.lang.reflect.Field
StandardJMeterEngine engine = ctx.getEngine()
Field test = engine.getClass().getDeclaredField("test")
test.setAccessible(true)
HashTree testPlanTree = (HashTree) test.get(engine)
SearchByClass
<IncludeController>
includeControllerSearch = new SearchByClass<>(IncludeController.class)
testPlanTree.traverse(includeControllerSearch)
Collection
<IncludeController>
includeControllers = includeControllerSearch.getSearchResults()
log.info('**************************************************')
includeControllers.each {
log.info('Module: ' + it.getName() + ' Comments: ' + it.getComment())
}
log.info('**************************************************')
This way you will get the information on Include Controllers printed to
/jmeter.log/ file


<Loading Image...>

So you can either find the information in the jmeter.log file by searching
for the above asterisks or amend the code to be a standalone application and
create PDF using i.e. Apache PDFBox <https://pdfbox.apache.org/> , anyway
further steps are out of scope for this mailing list.




--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@jmeter.apache.org
For additional commands, e-mail: user-***@jmeter.apache.org

Loading...