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

  • 相关阅读:
    使用 JDBC 驱动程序
    (转载)SQL Server 2008 连接JDBC详细图文教程
    (转载)VB中ByVal与ByRef的区别
    (转载)Java里新建数组及ArrayList java不允许泛型数组
    在VS2008环境下编写C语言DLL,并在C++和C#项目下调用 (转载)
    近期计划
    在服务器上使用python-gym出现的关于显示的问题
    字符串匹配
    Ubuntu18.04 桌面系统的个人吐槽(主要是终端)
    Ubuntu18.04上安装N卡驱动、CUDA、CUDNN三连
  • 原文地址:https://www.cnblogs.com/ceshi2016/p/5987010.html
Copyright © 2011-2022 走看看