Skip to content

Commit bf162c7

Browse files
committed
Release 0.6.1
Remove comments for Http callout Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent fa45e23 commit bf162c7

File tree

6 files changed

+31
-20
lines changed

6 files changed

+31
-20
lines changed

README.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endif::[]
1818
:pmtemplates: src/integrationTest/resources/pm-templates
1919
:imagesdir: docs/images
2020
:prewrap!:
21-
:revoman-version: 0.6.0
21+
:revoman-version: 0.6.1
2222

2323
'''
2424

@@ -499,10 +499,10 @@ See in Action:
499499

500500
If an exception is thrown during the procedure of any step,
501501
the <<Step Procedure>> *fails fast for that step*.
502-
However, the execution of next steps won't halt by default.
502+
However, the execution of next *steps won't halt by default*.
503503
You can configure this behavior to *fail-fast* using the below Configuration options:
504504

505-
* `haltOnAnyFailure` — This defaults to `false`. If set to `true`, the execution of steps fails-fast when it encounters a failure. This also halts if there is a HTTP error response
505+
* `haltOnAnyFailure` — This defaults to `false`. If set to `true`, the execution of steps fails-fast when it encounters a failure. This also halts if there is an HTTP error response
506506
* `haltOnFailureOfTypeExcept` — You may configure to Fail-fast only for a specific Failure type by providing an `ExeType`. Along with it, you may provide a `PostTxnStepPick` which is used to check if a Step can be ignored for that specific failure type or halt the execution of next steps
507507

508508
These Configuration options, as their names suggest,
@@ -515,6 +515,13 @@ bundled with ReṼoman under link:{sourcedir}/com/salesforce/revoman/input/confi
515515
e.g `withName`,
516516
`inFolder` etc. You can write a custom predicate of your own too.
517517

518+
==== Compose Modular Executions
519+
520+
* You don't have to squash all your steps into one mega collection. Instead, you can break them into easy-to-manage modular collections. `ReVoman.revUp()` accepts a list of collection paths through `templatePaths()`
521+
* But that doesn't mean you have to execute all these templates in one-go. You can make multiple `ReVoman.revUp()` calls for different collections.
522+
* If you wish to compose these executions in a specific order, you can use the `revUp()` overload which accepts a vararg `Kick` configs.
523+
** You can also achieve the same yourself, by adding the previous execution's `mutableEnv` to the current execution using the `dynamicEnvironment` parameter. This also comes in handy when you wish to execute a common step (e.g. `UserSetup`) inside a Test setup method and use that environment for all the tests.
524+
518525
[#_pre_step_and_post_step_hooks]
519526
=== Pre-Step and Post-Step Hooks
520527

@@ -641,13 +648,6 @@ test from link:{testdir}/com/salesforce/revoman/output/postman/PostmanEnvironmen
641648

642649
Each StepReport also has a `pmEnvSnapshot` to assert if a step has executed as expected and compare snapshots from different steps to examine the execution progress.
643650

644-
=== Compose Modular Executions
645-
646-
* You don't have to squash all your steps into one mega collection. Instead, you can break them into easy-to-manage modular collections. `ReVoman.revUp()` accepts a list of collection paths through `templatePaths()`
647-
* But that doesn't mean you have to execute all these templates in one-go. You can make multiple `ReVoman.revUp()` calls for different collections.
648-
* If you wish to compose these executions in a specific order, you can use the `revUp()` overload which accepts a vararg `Kick` configs.
649-
** You can also achieve the same yourself, by adding the previous execution's `mutableEnv` to the current execution using the `dynamicEnvironment` parameter. This also comes in handy when you wish to execute a common step (e.g. `UserSetup`) inside a Test setup method and use that environment for all the tests.
650-
651651
=== Custom Dynamic variables
652652

653653
ReṼoman comes

buildSrc/src/main/kotlin/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* ************************************************************************************************
77
*/
88
const val GROUP_ID = "com.salesforce.revoman"
9-
const val VERSION = "0.6.0"
9+
const val VERSION = "0.6.1"
1010
const val ARTIFACT_ID = "revoman"
1111
const val STAGING_PROFILE_ID = "1ea0a23e61ba7d"

src/integrationTest/resources/pm-templates/restfulapidev/restful-api.dev.postman_collection.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
"script": {
4444
"exec": [
4545
"var responseJson = pm.response.json();",
46-
"pm.environment.set(\"objId\", responseJson.id);",
47-
""
46+
"pm.environment.set(\"objId\", responseJson.id);"
4847
],
4948
"type": "text/javascript",
5049
"packages": {}
@@ -55,6 +54,8 @@
5554
"script": {
5655
"exec": [
5756
"var moment = require('moment')",
57+
"var _ = require('lodash')",
58+
"",
5859
"pm.environment.set(\"$currentYear\", moment().year())",
5960
"pm.environment.set(\"$randomPrice\", _.random(1, 1000))"
6061
],
@@ -68,7 +69,7 @@
6869
"header": [],
6970
"body": {
7071
"mode": "raw",
71-
"raw": "{\n \"name\": \"AI Phone\", \"data\": {\n \"year\": {{$currentYear}},\n \"price\": {{$randomPrice}}\n }\n}",
72+
"raw": "{\n \"name\": \"{{$randomProduct}}\", // Dynamic variable\n \"data\": {\n \"year\": {{$currentYear}}, // Variable set via Pre-req\n \"price\": {{$randomPrice}} // Variable set via Pre-req\n }\n}",
7273
"options": {
7374
"raw": {
7475
"language": "json"
@@ -108,4 +109,4 @@
108109
"response": []
109110
}
110111
]
111-
}
112+
}

src/main/kotlin/com/salesforce/revoman/internal/json/MoshiReVoman.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ open class MoshiReVoman(builder: Moshi.Builder) {
3838

3939
private inline fun <reified PojoT : Any> lenientAdapter(): JsonAdapter<PojoT?> =
4040
moshi.adapter<PojoT>(PojoT::class.java).lenient()
41-
41+
4242
fun <PojoT : Any> fromJson(input: String?, targetType: Type = Any::class.java): PojoT? =
4343
input?.let { lenientAdapter<PojoT>(targetType).fromJson(it) }
4444

@@ -55,10 +55,11 @@ open class MoshiReVoman(builder: Moshi.Builder) {
5555
fun <PojoT : Any> toPrettyJson(
5656
input: PojoT?,
5757
sourceType: Type = input?.javaClass ?: Any::class.java,
58-
indent: String = " "
58+
indent: String = " ",
5959
): String = lenientAdapter<PojoT>(sourceType).indent(indent).toJson(input)
60-
61-
inline fun <reified PojoT : Any> toPrettyJson(input: PojoT?, indent: String = " "): String = toPrettyJson(input, PojoT::class.java, indent)
60+
61+
inline fun <reified PojoT : Any> toPrettyJson(input: PojoT?, indent: String = " "): String =
62+
toPrettyJson(input, PojoT::class.java, indent)
6263

6364
fun <PojoT : Any> objToJsonStrToObj(
6465
input: Any?,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ private val dynamicVariableGenerators: Map<String, () -> String> =
5757
"\$randomWord" to faker.lorem::words,
5858
// Business
5959
"\$randomCompanyName" to faker.company::name,
60+
"\$randomProduct" to faker.industrySegments::sector,
6061
// Domains, emails, and usernames
6162
"\$randomEmail" to { faker.internet.email() },
6263
// Date time

src/main/kotlin/com/salesforce/revoman/internal/postman/template/Template.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,15 @@ data class Request(
6161
.Request(Method.valueOf(method), uri)
6262
.with(CONTENT_TYPE of contentType)
6363
.headers(header.map { it.key.trim() to it.value.trim() })
64-
.body(body?.raw?.trim() ?: "")
64+
.body(body?.raw?.trim()?.let { removeJsonComments(it) } ?: "")
65+
}
66+
67+
companion object {
68+
private fun removeJsonComments(json: String): String {
69+
val singleLineComment = """//.*""".toRegex()
70+
val multiLineComment = """/\*[\s\S]*?\*/""".toRegex()
71+
return json.replace(multiLineComment, "").replace(singleLineComment, "")
72+
}
6573
}
6674

6775
internal fun toPMSDKRequest(pm: PostmanSDK): PostmanSDK.Request = pm.from(this)

0 commit comments

Comments
 (0)