Closed afranken closed 11 years ago
I am working on a prototype:
Writing output is done by instances of Writer:
public interface Writer {
void write(Map<String, AggregatedResponses> testResults) throws IOException, TemplateException;
}
I already implemented all Writers and moved the code from ResultAnalyzer#analyze
.
The idea is that the list of writers can be configured as a property of the maven plugin like:
<writers>
<htmlWriter/>
</writers>
For example, several people asked about output per requested URL. That information is already collected, but only printed as a CSV file (now by CsvWriter). The same output could be written by a custom Writer implementation that just uses a different file name and different Freemarker templates.
works more or less as expected. Maven can create arbitrary objects and inject them as Parameters, but the classes either need to be in the same package as the Mojo, or the fully qualified classpath needs to be specified. Both not what I wanted... Currently, a configuration looks like this:
<writers>
<com.lazerycode.jmeter.analyzer.writer.SummaryTextToStdOutWriter/>
<com.lazerycode.jmeter.analyzer.writer.SummaryTextToFileWriter/>
<com.lazerycode.jmeter.analyzer.writer.HtmlWriter/>
<com.lazerycode.jmeter.analyzer.writer.CsvWriter/>
<com.lazerycode.jmeter.analyzer.writer.ChartWriter/>
</writers>
but since this list only needs to be configured if someone wants to add / remove a Writer, I guess this is ok...
The Mojo will fill the list with above mentioned Writers if no Writers are configured, or with the configured list of Writers.
We won't need the parameters <generateCSVs>
or <generateCharts>
any more since the functionality can be deactivated by just not adding a writer.
To disable both CVSs and Charts the list would need to look like this:
<writers>
<com.lazerycode.jmeter.analyzer.writer.SummaryTextToStdOutWriter/>
<com.lazerycode.jmeter.analyzer.writer.SummaryTextToFileWriter/>
<com.lazerycode.jmeter.analyzer.writer.HtmlWriter/>
</writers>
Output to stdout can be removed by removing SummaryTextToStdOutWriter
:
<writers>
<com.lazerycode.jmeter.analyzer.writer.SummaryTextToFileWriter/>
<com.lazerycode.jmeter.analyzer.writer.HtmlWriter/>
</writers>
Only HTML:
<writers>
<com.lazerycode.jmeter.analyzer.writer.HtmlWriter/>
</writers>
while it's already possible to write custom Freemarker templates to customize the output to stdout, textfile and HTML, it's not possible to add custom output.
Currently, it's only possible to completely replace one or more templatesets. It should be possible to easily add new ways to render output.