Jmeter+Ant interface automation environment configuration guide

1. Jmeter installation and configuration

https://blog.csdn.net/tester_sc/article/details/80746405

Note: There are some minor differences between the environment variable configuration of Jmeter5.0+ and 4.0 or previous older versions. The author uses Jmeter 5.0+

2. Ant installation and configuration

# Ant download address (after downloading to the specified directory, extract it to the current directory): http://ant.apache.org/bindownload.cgi#Verify%20Releases

# Configure Ant environment variables

Added ANT_HOME variable Value: Ant decompression installation location

Added CLASSPATH Value: %ANT_HOME%\lib;

The new PATH Value is: %ANT_HOME%\bin;

#Open the CMD terminal to verify whether the Ant installation is successful and enter: ant -v

3. Ant related file configuration

A. Copy the ant-jmeter-1.1.1.jar file to the Ant installation directory

# Copy the ant-jmeter-1.1.1.jar file in the Jmeter/extras directory to the lib folder in the ant installation directory.

Copy path (under the installation path of Jmeter): E:\Jmeter\apache-jmeter-5.3\extras

Target file:ant-jmeter-1.1.1.jar

Target path (under the ant installation path): E:\Jmeter\apache-ant-1.10.9\lib Just paste it there

 

B. Configure the ant compilation file build.xml (place it in the jmeter installation directory)

build.xml template reference address: https://blog.csdn.net/baijingchuan/article/details/83061568

The build.xml file is the core of the file configuration process. Enter script analysis. The relevant configurations in this file for calling Jmeter related scripts, generating reports, and report storage locations are all configured here. After getting the source code, make the following modifications: place, just save it

Preparation before configuration: Create a directory script under Jmter to store scripts.

Create the directory reports under Jmeter to store interface reports.

Just place the build.xml file in the Jmeter installation directory and it will be OK

For easy viewing and professionalism, you can create a project directory to store the above three directory files for the job. Enter the corresponding address configured in build.xml and enter your actual directory address.


C. Modify and update the jmeter.properties document

Enter the jmeter installation directory/bin directory and open the jmeter.properties file

jmeter.save.saveservice.output_format=csv jmeter.save.saveservice.output_format=xml

And remove the preceding comment symbol #

4. Create the project and run ant

# Create a script directory to store .jmx scripts in the Jmeter directory (used to store all interface files to be executed)

# Execution notes are used to debug the operation of Ant environment and generate reports to see whether the adjustment is successful. It is recommended that the number of interface script threads be set to 1, without looping and continuous

# Run ant: In the directory where build.xml is located, enter cmd in the path bar (or after entering cmd, enter the build.xml installation directory) enter ant in the terminal to run the interface script

 

# Enter BUILD SUCCESSFUL to run successfully.

5. View interface report

Set the report storage location path in the build.xml file. Open the directory and view the corresponding interface run report content. The following is the report style of the build.xml file template.

Then the jmeter+ant automated interface test environment configuration is basically completed here. If you encounter problems during the deployment process, find and solve the problems, and you will grow faster. 

 

Thank you to everyone who reads my article carefully. There is always a courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can also help you! Anyone in need Partners can click on the small card below to receive it

Guess you like

Origin blog.csdn.net/chengxuyuznguoke/article/details/132761579