翻譯|使用教程|編輯:莫成敏|2020-01-13 15:07:41.930|閱讀 296 次
概述:如果在開(kāi)發(fā)環(huán)境中使用Maven,則可以在構(gòu)建中包含LoadUI測(cè)試。為此,您可以命令Maven下載并在項(xiàng)目中使用ReadyAPI Maven插件。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
LoadUI Pro,業(yè)界最好的開(kāi)源API測(cè)試工具。通過(guò)一個(gè)可視化、拖拽式的界面,LoadUI允許您實(shí)時(shí)、交互式地創(chuàng)建、配置和重分配負(fù)載測(cè)試。在單一測(cè)試環(huán)境下,LoadUI提供完整的測(cè)試覆蓋,支持所有標(biāo)準(zhǔn)的協(xié)議和技術(shù)。它功能強(qiáng)大,能從任意數(shù)量的本地和遠(yuǎn)程機(jī)器生成可擴(kuò)展、大容量的工作負(fù)載。
ReadyAPI是API測(cè)試工具的集成套件,其中包括:SoapUI Pro (功能測(cè)試)、LoadUI Pro (性能測(cè)試)、ServiceV Pro (服務(wù)虛擬化)等產(chǎn)品。
如果在開(kāi)發(fā)環(huán)境中使用Maven,則可以在構(gòu)建中包含LoadUI測(cè)試。為此,您可以命令Maven下載并在項(xiàng)目中使用ReadyAPI Maven插件。
要求要從Maven運(yùn)行LoadUI測(cè)試,您需要在要運(yùn)行Maven構(gòu)建的計(jì)算機(jī)上具有以下內(nèi)容:
您不需要專(zhuān)門(mén)為運(yùn)行負(fù)載測(cè)試而配置環(huán)境,Maven將處理所有必需的依賴(lài)項(xiàng)。
Pom文件
Maven從pom.xml文件中讀取有關(guān)構(gòu)建的詳細(xì)信息。您需要對(duì)其進(jìn)行配置,以從Maven存儲(chǔ)庫(kù)獲取ReadyAPI插件,并將負(fù)載測(cè)試添加到構(gòu)建生命周期的測(cè)試階段。
您可以在下面找到示例Maven配置。如果您已經(jīng)擁有自己的配置,則將必要的元素復(fù)制到其中。
運(yùn)行負(fù)載測(cè)試
要啟動(dòng)負(fù)載測(cè)試,請(qǐng)使用pom.xml文件所在文件夾中的Maven test命令。 此命令將運(yùn)行負(fù)載測(cè)試并為其生成報(bào)告。 例如:
C:/Work/MvnSample> mvn test
如果您的測(cè)試使用Maven SureFire插件來(lái)創(chuàng)建報(bào)告,請(qǐng)改用site命令。
C:/Work/MvnSample> mvn site
樣本Maven負(fù)載測(cè)試
以下是運(yùn)行Baseline-load-test-project.xml項(xiàng)目的pom.xml示例文件。您可以在
您可以通過(guò)刪除未使用元素的注釋并輸入?yún)?shù)來(lái)指定負(fù)載測(cè)試的其他屬性。
如果您已經(jīng)擁有pom.xml文件,則將其復(fù)制到該文件中以在構(gòu)建中包括負(fù)載測(cè)試。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 //maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>my-app</artifactId> <version>1.0</version> <!--Add the SmartBear ReadyAPI plugin repository.--> <!--Maven will download the plugin from the specified URL.--> <pluginRepositories> <pluginRepository> <id>SmartBearPluginRepository</id> <url>http://smartbearsoftware.com/repository/maven2</url> </pluginRepository> </pluginRepositories> <build> <plugins> <plugin> <!--Plugin groupID used to uniquely identify the project with the plugin.--> <groupId>com.smartbear</groupId> <!--Plugin artifactId used to find the plugin in the project.--> <artifactId>ready-api-maven-plugin</artifactId> <!--Specifies your ReadyAPI version. Maven will use the appropriate plugin version.--> <!-- IMPORTANT: Must be the same as your ReadyAPI version.--> <version>1.6.1</version> <executions> <execution> <!--Specifies the lifecycle phase to run load tests .--> <!--We recommend using the test phase.--> <phase>test</phase> <goals> <!--Do not change. Commands the Maven plugin to run a load test.--> <goal>loadtest</goal> </goals> <configuration> <!--Required. Specifies the path to the project to be executed.--> <projectFile>Baseline-load-test-project.xml</projectFile> <!--Required. Specifies the name of the load test to be run.--> <loadTest>Baseline Load Test (Geocoding)</loadTest> <!--Required for reports. Specifies the format of the report to be generated.--> <!--Possible values: PDF, XLS, HTML, RTF, CSV, TXT and XML. --> <reportFormat>PDF</reportFormat> <!--Required for Maven Surefire reports. Must be true. --> <!--Commands LoadUI to generate JUnit-style reports.--> <junitReport>true</junitReport> <!--Required for> Maven Surefire reports. Must be as shown. --> <!--Specifies the folder to store reports in. --> <reports>${basedir}/target/surefire-reports</reports> <!-- ========= Additional elements ============= --> <!--If true, commands Maven to continue the test run even when an assertion triggers.--> <!--testFailIgnore>true</testFailIgnore--> <!--Specifies the number of virtual users to be simulated. --> <!--Has no effect if the "Per Scenario" load distribution is used.--> <!--users></users--> <!--Specifies existing statistics groups to be included in the report.--> <!--statistics></statistics--> <!--Specifies limits for the test run. --> <!--Syntax: <SECONDS>:<TARGETS>:<FAILURES> (for example, 60:0:200)--> <!--Project-defined time limits override this value.--> <!--limits></limits--> <!--Specifies the .CSV file to export the statistics group to. Syntax: <FileName>=<StatGroupName>--> <!--export></export--> <!--Specifies if the runner terminates requests running at the moment the test is stopped.--> <!--If true, ongoing requests will be canceled.--> <!--Otherwise, the test will finish when all requests are completed.--> <!--If not specified, project properties are used.--> <!--abort></abort--> <!--Specifies if the load is simulated from the local computer.--> <!--If true, the local computer is used. If false, configured agents are used.--> <!--If not specified, project properties are used.--> <!--local></local--> <!--Specifies the remote agents to be used for the test run. Syntax: <hostname[:port]>scenario</hostname[:port]>) --> <!--agents></agents--> <!--Sets the output folder for reports.--> <!--outputFolder></outputFolder--> <!--Specifies a settings file to be used.--> <!--settingsFile></settingsFile--> <!--Specifies a password for the encrypted settings file.--> <!--settingsPassword></settingsPassword--> <!--Specifies a password for the encrypted project file--> <!--projectPassword></projectPassword--> <!--Specifies the value of a global property for the test run. Syntax: <variable>=<value>--> <!--globalProperties></globalProperties--> <!--Specifies the value of a project property for the test run. Syntax: <variable>=<value>--> <!--projectProperties></projectProperties--> <!--Provides access to ReadyAPI properties.--> <!--readyApiProperties></readyApiProperties--> <!--If true, ReadyAPI will not send usage statistics.--> <!--optOutUsageStatistics></optOutUsageStatistics--> <!--Specifies the environment to be used in the test run.--> <!--environment></environment--> <!-- ========= /Additional elements ============= --> </configuration> </execution> </executions> </plugin> </build> </project>有關(guān)使用的插件的信息
此示例使用生成JUnit XML報(bào)告,并使用來(lái)提高測(cè)試穩(wěn)定性。根據(jù)插件的更改,您可能需要更改pom.xml文件。
本文內(nèi)容就是這樣了,感興趣的朋友可以繼續(xù)關(guān)注我們網(wǎng)站了解更多產(chǎn)品資訊,您也可以下載LoadUI Pro試用版免費(fèi)體驗(yàn)~
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: