Postman environment and use case set in interface testing

Environmental use of postman

There are environment settings in postman, that is, we often say that variables are used to replace a fixed value. The advantage of this is that you can switch between different domain names, different environment variables, and different online and offline accounts. Let's see how to use it.

Create an environment

Postman has a place for envrionment (environment) settings. Please see the picture below:


To set up an environment, click on that gear. Add a test environment variable set:

add another online environment variable set:

you can see that the host variable represents the online and offline domain names. In this way, test scenarios of different domain names can be covered. Use the tested domain name for testing when in the test environment, and use the online domain name for regression after going online.

Replace fixed values ​​with variables

In fact, in addition to using the domain name, it can also be used in user request parameters and request headers. You can experience it during the test.
The parameterization of postman provides a simple switching operation, which reduces the cost of writing multiple use cases because of different values. It is worth a try.

Postman's use case set

Use of collection

Creating a new collection is relatively simple, just create a new Collection under Collections. When we want to save a previous test case, just click Save. Then a save dialog box will pop up, like the following:

Just select the Collection folder you created below. This saves successfully.

Collection keeps in sync

There are many benefits of Collection, such as standardization, keeping in sync, easy to find, batch running, etc. Let me talk about how to keep in sync. The first is to register postman, I won't talk about this, it should pop up after installation. If you have not created an account before, you can also register through the last button Manage accounts. In this way, on different machines, you only need to log in to your account to synchronize the Collection.
The above content is the entire content of this article. The above content hopes to be helpful to you. Friends who have been helped are welcome to like and comment.
If you exchange experience in software testing, interface testing, automated testing, and interviews. If you are interested, please follow me. We will have technical exchanges with colleagues.

Guess you like

Origin blog.csdn.net/Chaqian/article/details/107068359