Batch execution of interface test cases in postman series

How does postman execute interface test cases in batches~ It's actually very simple, but it will bring a lot of convenience to our work~

For example, we have written dozens of test cases, and the requests are all from the same server IP. Once the server IP address is moved from the test environment to the online environment, all server IPs need to be modified.

If you can't save the test cases, modify the server IP uniformly, and execute them in batches, it will be a very troublesome thing!

But postman helped us solve this problem perfectly~ Please see below for specific operations

1. Create test case sets and subsets

As shown in the figure below, click the add folder icon under Collections on the left side of postman to create a test case set. A system, module or other classification granularity of test cases can be stored in this directory.

 

In addition, subdirectories can also be created in this directory to subdivide test cases, as shown in the following figure:

 

2. Create test cases

Create an interface test case, that is, create a new http request, select the request method, write the url, request header, and request body

3. Set variables

The variables of postman are similar to the parameterization of Jmeter, that is, the values ​​that appear multiple times in several places are represented by one variable, so as to achieve the effect of one modification and multiple effects, which is convenient for modification and management.

Click a button above postman, click the Edit button behind Globals, and add global variables

 

Click the Add button in the lower right corner to add the Environment Name, the Key value to write the variable name, the Value value to write the value corresponding to the variable, and click the Save button to save

 

Replace the place where the Value value has appeared with {{key}}, for example, take the following screenshot as an example, use "{{baseURL}}" instead of the place where http://172...57:8080 appears

4. Add response processing

Response processing is somewhat similar to the checkpoint in Jmeter, that is, it is judged whether the test passes by checking whether the response data meets the expectations. To add check conditions in Tests, postman provides some commonly used code for checking conditions, which can be added directly or modified slightly. For example, if the status code of the response data is 200, the test is judged to be passed, and then select "status code: code is 200" in the code slice

 

5. Batch execution of test cases

Click "run" in the test case set to run the test cases in batches, the collection runner will pop up, click "Run xxx", and run the test cases in batches

 

 

After running, the test result pops up, showing the number of test passes and failures, request URL, request header, request body information, response header, response body information, status code, etc., we can view the execution results and specific information of the test case.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326620352&siteId=291194637