Skip to content

Commit 6448ff0

Browse files
committed
Release 0.7.3
Add Request Response info in PostHookFailure Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 00984e7 commit 6448ff0

File tree

8 files changed

+37
-17
lines changed

8 files changed

+37
-17
lines changed

README.adoc

Lines changed: 20 additions & 9 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.7.2
21+
:revoman-version: 0.7.3
2222

2323
'''
2424

@@ -38,15 +38,32 @@ image::manual-to-automation.png[Manual to Automation, align="center"]
3838
[.lead]
3939
It strikes a balance between _flexibility_
4040
provided by low-level tools like https://rest-assured.io/[**REST Assured**] or https://cucumber.io/[**Cucumber**] and _ease of use_
41-
provided by UI tools like https://www.postman.com/[**Postman**]
41+
provided by UI tools like https://www.postman.com/[**Postman**].
4242

4343
image::hybrid-tool.png[]
4444

45+
[.lead]
46+
The fundamental principle of this tool is
47+
to automate your Postman collection on JVM *without compromising on Manual testing*.
48+
Which means
49+
the collections used in JVM automation can be maintained
50+
to always be ready for Manually trying them out importing into Postman.
51+
52+
== Why not use https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman[Newman] or https://learning.postman.com/docs/postman-cli/postman-cli-overview/#comparing-the-postman-cli-and-newman[Postman CLI]?
53+
54+
* ReṼoman may be similar to Newman or Postman CLI when it comes to executing a Postman collection, but the _similarities end there_
55+
* Newman or Postman CLI are built for node and cannot be executed within a JVM. Even if you are able to run in some hacky way, there is no easy way to assert results.
56+
* ReṼoman is JVM first that lets you seamlessly integrate with your existing Java ecosystem. It lets you configure more — for example, the <<#_pre_step_and_post_step_hooks,Hooks>> feature lets you plug in your custom JVM code in-between the execution.
57+
* ReṼoman has a strong emphasis on <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization,Type-Safety>>, leveraging JVM strong types over JSON for writing assertions and custom code
58+
59+
[.lead]
60+
Read more in the <<USP>>
61+
4562
== Artifact
4663

4764
[.lead]
4865
Maven
49-
[source,xml,subs=attributes+]
66+
[source,xml,subs=attributes+,tabsize=2]
5067
----
5168
<dependency>
5269
<groupId>com.salesforce.revoman</groupId>
@@ -737,12 +754,6 @@ You don't have to.
737754
This is a JVM-first tool,
738755
and you can interlace your TestUtils through <<#_plug_in_your_java_code_in_between_postman_execution,Pre-Step/Post-Step Hooks>>
739756

740-
=== Why not use https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman[Newman] or https://learning.postman.com/docs/postman-cli/postman-cli-overview/#comparing-the-postman-cli-and-newman[Postman CLI]?
741-
742-
* ReṼoman may be similar to Newman or Postman CLI when it comes to executing a Postman collection, but the _similarities end there_.
743-
* Newman or Postman CLI are built for node and cannot be executed within a JVM. Even if you are able to run in some hacky way, there is no easy way to assert results.
744-
* ReṼoman is JVM first that lets you configure a lot more, and gives you back a detailed report to assert in a typesafe way
745-
746757
== 🙌🏼 Consume-Collaborate-Contribute
747758

748759
* This link:CONTRIBUTING.adoc[CONTRIBUTING] doc has all the information to set up this library on your local and get hands-on.

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.7.2"
9+
const val VERSION = "0.7.3"
1010
const val ARTIFACT_ID = "revoman"
1111
const val STAGING_PROFILE_ID = "1ea0a23e61ba7d"

src/integrationTest/java/com/salesforce/revoman/integration/pokemon/PokemonTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ public void accept(@NotNull StepReport stepReport, @NotNull Rundown rundown) {
141141
.dynamicEnvironment(dynamicEnvironment)
142142
.off());
143143

144-
assertThat(pokeRundown.firstUnIgnoredUnsuccessfulStepReport().failure)
145-
.containsOnLeft(new PostStepHookFailure(RUNTIME_EXCEPTION));
144+
final var postHookFailure = pokeRundown.firstUnIgnoredUnsuccessfulStepReport().failure;
145+
assertThat(postHookFailure).containsLeftInstanceOf(PostStepHookFailure.class);
146+
assertThat(postHookFailure.getLeft().getFailure()).isEqualTo(RUNTIME_EXCEPTION);
146147
assertThat(pokeRundown.stepReports).hasSize(5);
147148
assertThat(pokeRundown.mutableEnv)
148149
.containsExactlyEntriesIn(

src/main/kotlin/com/salesforce/revoman/input/json/adapters/salesforce/CompositeResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ data class CompositeResponse(val compositeResponse: List<Response>) {
7878
}
7979
attributes = attributesJsonAdapter.fromJson(reader)
8080
}
81-
-1 -> recordBody[reader.nextName()] = reader.readJsonValue()!!
81+
-1 -> recordBody[reader.nextName()] = reader.readJsonValue()
8282
else -> throw AssertionError()
8383
}
8484
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal fun postStepHookExe(kick: Kick, pm: PostmanSDK): PostStepHookFailure? =
2424
runCatching(pm.currentStepReport.step, POST_STEP_HOOK) {
2525
postStepHook.accept(pm.currentStepReport, pm.rundown)
2626
}
27-
.mapLeft { PostStepHookFailure(it) }
27+
.mapLeft { PostStepHookFailure(it, pm.currentStepReport.requestInfo!!.get(), pm.currentStepReport.responseInfo!!.get()) }
2828
}
2929
.firstOrNull { it.isLeft() }
3030
?.leftOrNull()

src/main/kotlin/com/salesforce/revoman/output/report/failure/HookFailure.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ import com.salesforce.revoman.output.ExeType.POST_STEP_HOOK
1111
import com.salesforce.revoman.output.ExeType.PRE_STEP_HOOK
1212
import com.salesforce.revoman.output.report.TxnInfo
1313
import org.http4k.core.Request
14+
import org.http4k.core.Response
1415

1516
sealed class HookFailure : ExeFailure() {
1617

1718
data class PreStepHookFailure(
1819
override val failure: Throwable,
19-
val requestInfo: TxnInfo<Request>,
20+
@JvmField val requestInfo: TxnInfo<Request>,
2021
) : HookFailure() {
2122
override val exeType = PRE_STEP_HOOK
2223
}
2324

24-
data class PostStepHookFailure(override val failure: Throwable) : HookFailure() {
25+
data class PostStepHookFailure(
26+
override val failure: Throwable,
27+
@JvmField val requestInfo: TxnInfo<Request>,
28+
@JvmField val responseInfo: TxnInfo<Response>,
29+
) : HookFailure() {
2530
override val exeType = POST_STEP_HOOK
2631
}
2732
}

src/main/kotlin/com/salesforce/revoman/output/report/failure/HttpStatusUnsuccessful.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ import org.http4k.core.Request
1313
import org.http4k.core.Response
1414

1515
data class HttpStatusUnsuccessful(
16+
@JvmField
1617
val requestInfo: TxnInfo<Request>,
18+
@JvmField
1719
val responseInfo: TxnInfo<Response>,
1820
) {
21+
@JvmField
1922
val exeType = HTTP_STATUS
2023
}

src/test/kotlin/com/salesforce/revoman/output/report/StepReportTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class StepReportTest {
123123
Right(requestInfo),
124124
null,
125125
Right(responseInfo),
126-
PostStepHookFailure(RuntimeException("fakeRTE")),
126+
PostStepHookFailure(RuntimeException("fakeRTE"), requestInfo, responseInfo),
127127
PostmanEnvironment(),
128128
)
129129
println(stepReportPostStepHookFailure)

0 commit comments

Comments
 (0)