zoukankan      html  css  js  c++  java
  • Jmeter-Maven-Plugin高级应用:Test Results File Format-Test Results

    Test Results File Format

    Test Results


    Disabling The <testResultsTimestamp>

    By default this plugin will add a timestamp to each results file that it generates. If you do not want a timestamp added you can disable this behaviour by setting the<testResultsTimestamp> configuration setting to false.

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <testResultsTimestamp>false</testResultsTimestamp>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    Enabling <appendResultsTimestamp>

    When <testResultsTimestamp> is set to true the default positioning of the timestamp is at the start of the results filename. You can set the <appendResultsTimestamp&gt to true to make the plugin add the timestamp to the end of the results filename.

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <appendResultsTimestamp>true</appendResultsTimestamp>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    Setting The <resultsFileNameDateFormat>

    The default format for the timestamp added to results filenames created by the plugin is a basic ISO_8601 date format (YYYMMDD). You can modify the format of the timestamp by setting the<resultsFileNameDateFormat> configuration setting, we use a JodaTime DateTimeFormatter (See http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html)

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <resultsFileNameDateFormat>MMMM, yyyy</resultsFileNameDateFormat>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    Choosing The <resultsFileFormat>

    JMeter is capable of creating .jtl (an XML format) test results and csv test results. By default this plugin uses the .jtl format so that it can scan the result file for failures. You can switch thos to csv format if you would prefer, but the plugin is currently unable to parse .csv files for failures and .csv files will not work with the JMeter Analysis Maven Plugin.

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <resultsFileFormat>csv</resultsFileFormat>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    Specify the <resultsDirectory>

    By default all JMeter test result will be written to${project.base.directory}/target/jmeter/results. To can modify this by setting the<resultsDirectory> to an explicit file location.

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <resultsDirectory>/tmp/jmeter</resultsDirectory>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    Setting <ignoreResultFailures>

    By default the this plugin will stop maven execution if any failures are found within the .jtl results file (it is currently unable to scan .csv results files so any failures in a csv file will be ignored). If you don't want the maven execution to stop you can tell the plugin to ignore failures using the<ignoreResultFailures> configuration setting.

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <ignoreResultFailures>true</ignoreResultFailures>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    Setting <suppressJMeterOutput>

    By default all JMeter output is printed to the console. If you do not want to see all of the output generated by JMeter you can turn it off by setting the <suppressJMeterOutput> configurations setting to true.

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <suppressJMeterOutput>true</suppressJMeterOutput>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    Setting <skipTests>

    You can now use the <skipTests> configurations setting to make maven skip the performance tests. Suggested configuration is as follows:

    +---+
    <project>
        [...]
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.0.3</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <skipTests>${skipTests}</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        [...]
    </project>
    +---+

    This will allow you to run:

    mvn verify –DskipTests=true
    

    And the performance test step will be skipped

  • 相关阅读:
    58同城2018提前批前端笔试题总结
    两栏式布局和三栏式布局
    Less学习总结
    网易2018提前批前端笔试编程题
    编写一个函数isMerge,判断一个字符串str是否可以由其他两个字符串part1和part2“组合”而成
    【转】 解释下浏览器是如何判断元素是否匹配某个 CSS 选择器?
    JS数组精简的十三个技巧
    Docker常用命令(命令大全)
    ES6之新的数据结构
    JavaScript高级程序设计(第3版)每章小结(1-5)
  • 原文地址:https://www.cnblogs.com/ceshi2016/p/5987010.html
Copyright © 2011-2022 走看看