Skip to content

Commit 27b392d

Browse files
committed
- Doc improvement for Execution control
- Javadoc edits - Minor logging changes Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 012465b commit 27b392d

File tree

3 files changed

+63
-19
lines changed

3 files changed

+63
-19
lines changed

README.adoc

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ assertThat(pqRundown.mutableEnv)
312312
<10> <<#_pre_step_and_post_step_hooks>>
313313
<11> <<Response Validations>>
314314
<12> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Global Custom Type Adapters>>
315-
<13> Ignore Java cert issues when firing HTTP calls
315+
<13> Ignore Java cert issues when firing HTTP calls. To be used only for local testing, like hitting localhost
316316
<14> Run more assertions on the <<Rundown>>
317317

318318
endif::[]
@@ -335,7 +335,7 @@ include::{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWi
335335
<10> <<#_pre_step_and_post_step_hooks>>
336336
<11> <<Response Validations>>
337337
<12> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Global Custom Type Adapters>>
338-
<13> Ignore Java cert issues when firing HTTP calls
338+
<13> Ignore Java cert issues when firing HTTP calls. To be used only for local testing, like hitting localhost
339339
<14> Run more assertions on the <<Rundown>>
340340
endif::[]
341341

@@ -344,15 +344,17 @@ endif::[]
344344
You can define a base common config and reuse it by overriding certain properties using the `override...()` methods,
345345
which are present for each config attribute
346346

347-
== Debugging UX
347+
[#_debugging_dx]
348+
== Troubleshooting DX
348349

350+
=== IDE debugger view
349351
[.lead]
350-
This tool has a particular emphasis on the Debugging experience. Here is what a debugger view of a <<Rundown>> looks like:
352+
This tool has a particular emphasis on the Debugging experience.Here is what a debugger view of a <<Rundown>> looks like:
351353

352354
image:rundown.png[Rundown of all steps]
353355

354356
[.lead]
355-
🔍 Let's zoom into a detailed view of one of those Step reports, which contains complete Request and Response info along with failure information if any:
357+
🔍 Let's zoom into a detailed view of one of these Step reports, which contains complete Request and Response info along with failure information if any:
356358

357359
image:step-report.png[Step Report]
358360

@@ -361,25 +363,41 @@ Here are the environment *key-value* pairs accumulated along the entire executio
361363

362364
image:mutable-env.png[Mutable environment after the execution completion]
363365

366+
[#_granular_failure_reporting]
367+
=== Granular Failure reporting
368+
364369
[.lead]
365-
If something goes wrong at any stage during the Step execution, ReṼoman *fails-fast* and captures the `Failure` in StepReport:
370+
During a step execution if something goes wrong (like ) at any of these stages
371+
ReṼoman captures the `Failure` in StepReport:
366372

367373
image:step-execution.png[Step Execution]
368374

375+
[NOTE]
376+
====
377+
* `HttpRequestFailure` happens if there is an exception while making the request.It is different from HTTP Error response.
378+
* HTTP Success or Error response is determined by default with HTTP Status Code (SUCCESSFUL: `200 < = statusCode < = 299`).
379+
* HTTP Error response does *NOT* halt the execution by default.
380+
* You can control this behavior using <<_execution_control>>
381+
====
382+
369383
[.lead]
370384
Here is the failure hierarchy of what can go wrong in this process
371385

372386
image::failure-hierarchy.png[Failure Hierarchy]
373387

388+
=== Logging
389+
374390
[.lead]
375391
ReṼoman logs all the key operations that happen inside its source-code,
376392
including how the environment variables are being mutated by a step in its <<Pre-req and Post-res scripts>>.
377393
Watch your console to check what's going on in the execution or troubleshoot from CI/CD logs
378394

379-
NOTE: link:docs/revoman.exe.log[📝Sample log] printed during execution
395+
TIP: link:docs/revoman.exe.log[📝Sample log] printed during execution
380396

381397
image:pq-exe-logging.gif[Monitor Execution]
382398

399+
TIP: If the execution halts due to any failure, the failure and failed step information can be found in the logs for easy troubleshooting
400+
383401
== Features
384402

385403
[#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization]
@@ -456,14 +474,26 @@ See in Action:
456474
* link:{integrationtestdir}/com/salesforce/revoman/input/json/JsonPojoUtils2Test.java[JsonPojoUtils2Test]
457475
====
458476

477+
[#_execution_control]
459478
=== Execution Control
460479

461-
The configuration offers methods through which the execution strategy can be controlled without making any changes to the template:
480+
If an exception is thrown during the execution of any step,
481+
the execution *fails fast for that step*,
482+
and captures the exception as a <<_granular_failure_reporting,Failure>> in the StepReport.
483+
However, the execution of next steps may or may not halt, depending on the below Configuration options:
484+
485+
* `haltOnAnyFailure` — This defaults to `false`. If set to `true`, the execution of steps fails-fast when it encounters a failure.
486+
* `haltOnFailureOfTypeExcept` — This accepts pairs of `ExeType` and a `PostTxnStepPick` which are used to check if a Step can be ignored for failure for a specific failure type or halt the execution of next steps
487+
488+
These Configuration options, as their names suggest,
489+
let you conditionally run or skip steps in a chain of steps from the template, without the need to change the template.
462490

463-
* `haltOnAnyFailure` — This defaults to `false`. If set to `true`, the execution fails-fast when it encounters a failure.
464-
* `haltOnFailureOfTypeExcept` — This accepts pairs of `ExeType` and a `PostTxnStepPick` which are used to check if a Step can be ignored for failure for a specific failure type
465-
* `runOnlySteps`, `skipSteps` — All these accept a `predicate` of type `ExeStepPick`, which is invoked passing the current `Step` instance to decide whether to execute or skip a step.
466-
** There are some `ExeStepPick` predicates bundled with ReṼoman under `ExeStepPick.PickUtils` e.g `withName`, `inFolder` etc. You can write a custom predicate of your own too.
491+
* `runOnlySteps`, `skipSteps` — These accept a `predicate` of type `ExeStepPick`, which is invoked passing the current `Step` instance to decide whether to execute or skip a step.
492+
493+
TIP: There are some `ExeStepPick` predicates
494+
bundled with ReṼoman under link:{sourcedir}/com/salesforce/revoman/input/config/StepPick.kt[`ExeStepPick.PickUtils`]
495+
e.g `withName`,
496+
`inFolder` etc. You can write a custom predicate of your own too.
467497

468498
[#_pre_step_and_post_step_hooks]
469499
=== Pre-Step and Post-Step Hooks
@@ -473,8 +503,10 @@ A hook lets you fiddle with the execution by plugging in your custom JVM code be
473503
[#_step_picks]
474504
You can pass a `PreTxnStepPick/PostTxnStepPick` which is a `Predicate` used
475505
to qualify a step for Pre-Step/Post-Step Hook respectively.
506+
476507
ReṼoman comes
477-
bundled with some predicates under the namespace `PreTxnStepPick.PickUtils`/`PostTxnStepPick.PickUtils` e.g `beforeStepContainingURIPathOfAny()`,
508+
bundled with some predicates under the namespace link:{sourcedir}/com/salesforce/revoman/input/config/StepPick.kt[`PreTxnStepPick.PickUtils`/`PostTxnStepPick.PickUtils`]
509+
e.g `beforeStepContainingURIPathOfAny()`,
478510
`afterStepName()` etc. If those don't fit your needs, you can write your own custom predicates like below:
479511

480512
[source,java,indent=0,tabsize=2,options="nowrap"]
@@ -598,8 +630,12 @@ Each StepReport also has a `pmEnvSnapshot` to assert if a step has executed as e
598630

599631
=== Custom Dynamic variables
600632

601-
If the in-built dynamic variables don't fit your needs, you can plug your own dynamic variable generator
602-
to be invoked to generate a value for your custom variable-key in the template at runtime.
633+
ReṼoman comes
634+
bundled with some link:{sourcedir}/com/salesforce/revoman/internal/postman/DynamicVariableGenerator.kt[Dynamic variable generators].
635+
If the in-built dynamic variables don't fit your needs, you can plug your own dynamic variable generator,
636+
by providing an instance of `CustomDynamicVariableGenerator`.
637+
This shall
638+
be invoked to generate a value for your custom variable-key in the template at runtime
603639

604640
== USP
605641

src/main/kotlin/com/salesforce/revoman/internal/exe/ExeUtils.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ internal fun shouldHaltExecution(
102102
logger.info { "${currentStepReport.step} failed with ${currentStepReport.failure}" }
103103
when {
104104
kick.haltOnAnyFailure() -> {
105-
logger.info { "🛑 Halting the execution, as `haltOnAnyFailure` is set to true" }
105+
logger.info {
106+
"🛑 Halting the execution of next steps, as `haltOnAnyFailure` is set to true"
107+
}
106108
true
107109
}
108110
kick.haltOnFailureOfTypeExcept().isEmpty() -> {
109111
logger.info {
110-
"Continuing the execution, as `haltOnAnyFailure` is set to false and `haltOnFailureOfTypeExcept` is empty"
112+
"Continuing the execution of next steps, as `haltOnAnyFailure` is set to false and `haltOnFailureOfTypeExcept` is empty"
111113
}
112114
false
113115
}
@@ -126,9 +128,9 @@ internal fun shouldHaltExecution(
126128
.also {
127129
logger.info {
128130
if (it) {
129-
"${currentStepReport.step} doesn't qualify `haltOnFailureOfTypeExcept` for ${currentStepReport.exeTypeForFailure}, so 🛑 halting the execution"
131+
"${currentStepReport.step} doesn't qualify `haltOnFailureOfTypeExcept` for ${currentStepReport.exeTypeForFailure}, so 🛑 halting the execution of next steps"
130132
} else {
131-
"Continuing the execution, as the step qualifies `haltOnFailureOfTypeExcept` for ${currentStepReport.exeTypeForFailure}"
133+
"Continuing the execution of next steps, as the step qualifies `haltOnFailureOfTypeExcept` for ${currentStepReport.exeTypeForFailure}"
132134
}
133135
}
134136
}

src/main/kotlin/com/salesforce/revoman/internal/postman/DynamicVariableGenerator.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ private val faker = faker {}
2121
* @see <a
2222
* href="https://learning.postman.com/docs/writing-scripts/script-references/variables-list/">Postman
2323
* Variables</a>
24+
*
25+
* This may not be an exhaustive list of all dynamic variables supported by Postman. We keep
26+
* adding on the need-basis so it will grow over time. If what is need is not present here, You
27+
* may either contribute or use @see <a
28+
* href="https://github.com/salesforce-misc/ReVoman#custom-dynamic-variables/">Custom Dynamic
29+
* Variables</a>
2430
*/
2531
private val dynamicVariableGenerators: Map<String, () -> String> =
2632
mapOf(

0 commit comments

Comments
 (0)