Postman:是否可以在集合运行器中自定义测试运行的顺序自定义、顺序、器中、测试

2023-09-07 10:45:28 作者:输了你赢了全世界又如何

我的邮递员集合中有几个测试,但其中一些依赖于集合中的少数其他测试,因为后者设置了一些其他测试使用的 envt 变量.我希望这些按顺序运行.我集合中的测试分布在不同的文件夹中.是否有可能在类似结构的测试套件中定义这样的序列?

I have several tests in my postman collection but some of them are dependent on few others from within the collection as the latter set some envt variables that are used by other tests. I want these to run in a sequence. The tests in my collection are distributed across different folders. Is there a possibility to define such a sequence in a test suite like structure?

推荐答案

根据每个文件夹和测试在 Postman 中的显示方式来执行.

The execution happens according to how the folders and tests within each is displayed inside Postman.

在一个集合中,我通常根据执行顺序对我的文件夹进行编号,然后各个测试也可以使用数字作为前缀,以便您控制执行.请参阅随附的屏幕截图.

In a collection, I normally number my folders according to the execution order and then the individual tests can be prefixed with numbers as well, so that you control the execution. Refer to the attached screenshot.

还有一个 postman.setNextRequest('Request-title'); 方法可以自定义您接下来要执行的请求.

Also there's a postman.setNextRequest('Request-title'); method to customize which request you want to execute next.

来源 - http://blog.getpostman.com/2016/03/23/conditional-workflows-in-postman/