jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "glinius@live.com" <glin...@live.com>
Subject Re: Print thread groups including comments fields of underlying controllers
Date Tue, 09 Oct 2018 09:08:18 GMT
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
 3. Put the following code into "Script" area:



> 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 


<http://www.jmeter-archive.org/file/t340375/foo.png> 

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-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message