How can I specify path to jtl files when I want to

2019-09-05 05:16发布

I use jmeter-maven-plugin (version 1.10.0) to run JMeter test - first I run it from IntelliJ, then from TeamCity (for both - command: mvn jmeter-graph:create-graph)

When I want to use the following configuration for jmeter-graph-maven-plugin:

<plugin>
    <groupId>de.codecentric</groupId>
    <artifactId>jmeter-graph-maven-plugin</artifactId>
    <version>0.1.0</version>
    <configuration>                           
        <inputFile>${project.build.directory}/jmeter/results/*.jtl</inputFile>
        <graphs>
            <graph>
                 <pluginType>TransactionsPerSecond</pluginType>
                 <outputFile>${project.build.directory}/jmeter/results/TPS.png</outputFile>
            </graph>
        </graphs>
    </configuration>
</plugin>

it works from IntelliJ, but in TeamCity I get:
ERROR: java.lang.IllegalArgumentException: Cannot find specified JTL file: /project/XX/opt/team-city-8.0.5/buildAgent/work/xxxxx/JMeter/target/jmeter/results/*.jtl

Result file exists (and it is previous used in xml-maven-plugin - even configuration is *.jtl - xml plugin works correctly in TeamCity).

When I use specific file name (so e.g. 20150317test-result.jtl instead of *.jtl) it works also from TeamCity. How can I use general file name? Or maybe there is an option in jmeter-maven-plugin to define some fixed jtl file name (and then use it in jmeter-graph-maven-plugin)?

1条回答
Viruses.
2楼-- · 2019-09-05 05:33

I did workaround for this issue. I changed jmeter-graph-maven-plugin configuration to:

<inputFile>${project.build.directory}/jmeter/results/${fileName}.jtl</inputFile>

and now I run it using mvn jmeter-graph:create-graph -DfileName=%profile% (where profile name is the same as jmx test file).

查看更多
登录 后发表回答