You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,9 +29,45 @@ The `utils` functions are logically grouped in nested classes (namespaces) and i
29
29
*[**Trace functions**](#trace-functions) for trace logging
30
30
*[**General purpose functions**](#general-purpose-functions) for miscellaneous operations
31
31
32
-
## Folder level functions
33
-
Before we get to the overview of the folder level functions, let's summarize how folder scripts work. Folder scripts can be defined for pre-requests and post-requests. For each request in the test collection being executed, Postman first runs pre-request scripts defined in all request parent folders starting from the top level folder. Then Postman runs request's pre-request script, executes the request, and runs all post-request scripts defined in the parent folder just as it did with folder pre-requests. Finally, it runs request tests. And it is worth repeating: this logic gets executed for every request in the test collection. You may not need to run any scripts for any or all folders, which is fine: you simple do not add any code to them; but when you do, you may need to run the code once per test collection execution or for every request in the collection.
32
+
# Request workflow
33
+
Before we get to the function definitions, let's summarize how requests work, so we know what gets executed when.
34
+
35
+
For each request in the test collection being executed, Postman first runs pre-request scripts defined in all request parent folders starting from the top level folder. Then Postman runs request's pre-request script, executes the request, and runs all post-request scripts defined in the parent folder just as it did with folder pre-requests. Finally, it runs request tests. And it is worth repeating: this logic gets executed for every request in the test collection. You may not need to run any scripts for any or all folders, which is fine: you simple do not add any code to them; but when you do, you may need to run the code once per test collection execution or for every request in the collection.
36
+
37
+
Let's use the following example:
38
+
```
39
+
- Collection
40
+
|
41
+
- Folder A
42
+
|
43
+
- Folder B
44
+
|
45
+
- REQUEST X
46
+
- REQUEST Y
47
+
```
48
+
49
+
Assuming that all folders and requests have pre-request and test scripts, the execution will go like this:
50
+
51
+
1. Collection pre-request script.
52
+
2. Folder A pre-request script.
53
+
3. Folder B pre-request script.
54
+
4. REQUEST X pre-request script.
55
+
5. REQUEST X
56
+
6. Collection test script.
57
+
7. Folder A test script.
58
+
8. Folder B test script.
59
+
9. REQUEST X test script.
60
+
10. Collection pre-request script.
61
+
12. Folder A pre-request script.
62
+
13. Folder B pre-request script.
63
+
14. REQUEST Y pre-request script.
64
+
15. REQUEST Y
65
+
16. Collection test script.
66
+
17. Folder A test script.
67
+
18. Folder B test script.
68
+
19. REQUEST Y test script.
34
69
70
+
## Folder level functions
35
71
Use folder level functions to run test or pre-request code attached to test collection folders (but not request scripts).
36
72
37
73
Folder level functions are grouped under the `utils.run` namespace and include:
0 commit comments