Parameterized Jmeter data driver (DDT)

  introduction

  Prior written a Python-based interfaces + automated testing framework data and code separation (Advanced chapter) with source code , this is primarily the interface data python test drive, abbreviation: "ddt". Here jmeter use in practical work to do data-driven interface test.

  Test data preparation

  First create csv file as a test data input, as follows:

 

 

 

Above save and exit can also use a text editor to edit, pay attention to punctuation.

Precautions:

1, if the content is Chinese assertion, garbled runtime, available txt Open, Save As, select the format: utf-8

2, if you write a five use cases and found only run three, the problem may be due to the format or quotation marks cause, solution Reference: https://blog.csdn.net/lykio_881210/article/details/88818898

Of course, if you never met these two problems can be ignored, we continue to go down.

 

  Parametric configuration

  Test data is ready, the next step is a reference parameter of the problem, open the CSV configuration jmeter of:

 

 

 

  Structure use case

  The next step is to write an interface test script, the script is used to perform an interface test case, as shown:

 

 

 

The outer layer is cycler:

 

 

The second layer is a set of test cases:

 

 

The third layer condition controller:

 

 

The fourth layer is the real interface requests:

 

The fifth layer is that some of the assertions and test results:

 

 

 

  testing report

The use of ant build test, generate html reports, and how to install and configure ant build.xml file, I can not say here, you can look for online tutorials.

After installation is complete, the new testcase file in the installation directory folder jmeter:

 

 After entering a look:

 

 

Then cd to the next testcase directory, type ant can perform the test directory:

 

 

View into the folder:

 

 

Because I configured in two buid.xml in the report template is a summary, is a detail, so there are two folders in html.

 

This is a request for details of report data:

 

 

Look at summary report:

 

Of course, you can also generate test reports with Dashboard, followed by a time of introduction.

 

 

 

Small code word is not easy, please indicate. Welcome to the automated test development study and exchange groups: 696 400 122, concerned about the small series, full of dry goods for update. Learn and grow together ~

Note: The data-driven template in this article, test scripts, and build.xml compile files can be downloaded into the group.

 

Published 82 original articles · won praise 43 · views 180 000 +

Guess you like

Origin blog.csdn.net/liudinglong1989/article/details/104872813
ddt