Skip to content

Commit 5fce440

Browse files
committed
Minor doc updates
Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent ff9c9a7 commit 5fce440

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

README.adoc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -483,36 +483,41 @@ npm install moment
483483
.Use inside pre-req and post-res scripts
484484
[source,javascript,indent=0,options="nowrap"]
485485
----
486-
var moment = require("moment");
487-
pm.environment.set("$currentDate", moment().format(("YYYY-MM-DD")));
488-
var futureDateTime = moment().add(365, 'days');
489-
pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));
486+
var moment = require("moment")
487+
var _ = require('lodash')
490488
491-
pm.environment.set("$quantity", _.random(1, 10)); // lodash doesn't need `require`
489+
pm.environment.set("$currentDate", moment().format(("YYYY-MM-DD")))
490+
var futureDateTime = moment().add(365, 'days')
491+
pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'))
492+
493+
pm.environment.set("$quantity", _.random(1, 10))
492494
----
493495

494496
[TIP]
495497
====
496-
* `node_modules` adds a lot of files to check-in. You may replace them with a single distribution file
498+
* `node_modules` Adds a lot of files to check in. You may replace them with a single distribution file
497499
498500
image::node_modules.png[]
499501
500502
* If `node_modules` is ignored on your git repo, you can force-add to check in using the command `git add -all -f <path>/node_modules`
501503
====
502504

503-
CAUTION: The recommendation is not to add too much code in <<Pre-req and Post-res scripts>>, as it is not intuitive to troubleshoot. Use it for simple operations like set environment variables and use Post-Hooks JVM code for any non-trivial operations.
505+
CAUTION: The recommendation is not to add too much code in <<Pre-req and Post-res scripts>>, as they not intuitive to troubleshoot through debugging. Use it for simple operations like set environment variables and use <<#_pre_step_and_post_step_hooks,Pre-Step /Post-Step Hooks>> for any non-trivial operations, which are intuitive to debug.
504506

505507
[#_mutable_environment]
506508
=== Mutable Environment
507509

508510
* Environment is the only mutable-shared state across step executions, which can be used for data passing between the consumer and the library.
509-
* This can be mutated (set key-value pairs) through <<Pre-req and Post-res scripts>> (using `pm.environment.set()`) and <<#_pre_step_and_post_step_hooks,Pre-/Post-Hooks>> (using the reference `rundown.mutableEnv`) during execution.
511+
* This can be mutated (set key-value pairs) through <<Pre-req and Post-res scripts>> (using `pm.environment.set()`) and <<#_pre_step_and_post_step_hooks,Pre-Step /Post-Step Hooks>> (using the reference `rundown.mutableEnv`) during execution.
510512

511513
==== Read Mutable Environment as Postman Environment JSON format
512514

513515
You may want to troubleshoot manually with Postman using the Mutable environment built during the ReṼoman execution.
514516
`rundown.mutableEnv.postmanEnvJSONFormat()` converts the mutable environment into a Postman JSON format,
515-
so you can copy and import that conveniently into Postman.
517+
so you can copy and import that environment conveniently into Postman.
518+
519+
TIP: You do NOT need to save the copied Postman environment JSON from the debugger into file.
520+
You can paste (kbd:[Ctrl+v]) directly in the Postman environment window
516521

517522
==== `pmEnvSnapshot` in each StepReport
518523

0 commit comments

Comments
 (0)