jmeter interface data and database data inspection!

Preface

This article explains how to use jmeter to test the interface, and then verify and compare it with the data in the database. This section uses an interface for adding new data, adds a piece of data, and then queries the database to see if this piece of data can be found.

1. Interface environment construction

1.1 Create a new http request and write the content of the request. My approximate request is as follows. The post request submits a new piece of data. If successful at this time, a piece of related data will be generated in the corresponding database.

1.2 If the request involves headers, you can add a new HTTP header manager to write the header information of the request.

1.3 Added a new JSON extractor to extract information that needs to be verified with the database.

Extractor rules:

Names of created variables: variable names, that is, variable names of the extracted data

JSON Path expressions: Extraction rules, which conform to regular expressions. What is extracted here is the data in the response result of the request interface.

View the response result in JSON form: $ represents the JSON root node, $. represents the next node, $.ResultObject means to find the ResultObject value under the root node, and $.ResultObject.CrawlProduct means to find the value under the root node first. ResultObject value, and then look for the CrawlProduct value under ResultObject, and so on.

2. Database environment construction

Build the database that needs to be queried. You can view this document for the database building address: https://www.cnblogs.com/longlongleg/p/15213967.html

Here we refer to the data of the interface we just extracted to query. Because the URL address of the successfully added product will also be retained in the database, and the address is unique, so as long as the product can be found through the address, it proves that the product has been added successfully to the database.

${productURL} is the way to reference variables. You can check that the data returned by the database interface is normal to prove success.

Finally, I would like to thank everyone who read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are from the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.
 

Insert image description here

Supongo que te gusta

Origin blog.csdn.net/jiangjunsss/article/details/132890622
Recomendado
Clasificación