Repository: authorjapps/zerocode
Pull request #379 (2020-04-07 17:43:31)

Issue -378 Method details added
Issue -378 Method details added

# <Feature Title>

PR Branch
**_#ADD LINK TO THE PR BRANCH_**

## Motivation and Context

## Checklist:

* [x] Unit tests added?

* [ ] Integration tests added?

* [x] Test names are meaningful?

* [x] Feature manually tested?

* [ ] Branch build passed?

* [ ] No 'package.*' in the imports

* [ ] Relevant Wiki page updated with clear instruction for the end user

* [ ] Http test added to `http-testing` module(if applicable) ?

* [ ] Kafka test added to `kafka-testing` module(if applicable) ?



Patch:
diff --git a/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeCsvReportBuilder.java b/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeCsvReportBuilder.java
index 4bb77e61..9346fa9c 100644
--- a/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeCsvReportBuilder.java
+++ b/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeCsvReportBuilder.java
@@ -9,6 +9,7 @@ public class ZeroCodeCsvReportBuilder {
     private Integer stepLoop;
     private String correlationId;
     private String result;
+    private String method;
     String requestTimeStamp;
     String responseTimeStamp;
     private Double responseDelayMilliSec;
@@ -19,7 +20,7 @@ public class ZeroCodeCsvReportBuilder {
 
     public ZeroCodeCsvReport build() {
         ZeroCodeCsvReport built = new ZeroCodeCsvReport(scenarioName,scenarioLoop,stepName, stepLoop,
-                correlationId, result, requestTimeStamp, responseTimeStamp, responseDelayMilliSec);
+                correlationId, result, method, requestTimeStamp, responseTimeStamp, responseDelayMilliSec);
         return built;
     }
 
@@ -53,6 +54,11 @@ public class ZeroCodeCsvReportBuilder {
         return this;
     }
 
+    public ZeroCodeCsvReportBuilder method(String method) {
+        this.method = method;
+        return this;
+    }
+
     public ZeroCodeCsvReportBuilder requestTimeStamp(String requestTimeStamp) {
         this.requestTimeStamp = requestTimeStamp;
         return this;
diff --git a/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeReportStepBuilder.java b/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeReportStepBuilder.java
index b8f83817..7a2a2f89 100644
--- a/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeReportStepBuilder.java
+++ b/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeReportStepBuilder.java
@@ -8,6 +8,7 @@ public class ZeroCodeReportStepBuilder {
     Integer loop;
     String name;
     String url;
+    String method;
     String correlationId;
     String operation;
     LocalDateTime requestTimeStamp;
@@ -26,7 +27,7 @@ public class ZeroCodeReportStepBuilder {
 
     public ZeroCodeReportStep build() {
         ZeroCodeReportStep built = new ZeroCodeReportStep(
-                loop, name, url,
+                loop, name, url, method,
                 correlationId, operation, requestTimeStamp,
                 responseTimeStamp, responseDelay, result,
                 request, response, assertions, customLog);
@@ -48,6 +49,10 @@ public class ZeroCodeReportStepBuilder {
         return this;
     }
 
+    public ZeroCodeReportStepBuilder method(String method) {
+        this.method = method;
+        return this;
+    }
     public ZeroCodeReportStepBuilder correlationId(String correlationId) {
         this.correlationId = correlationId;
         return this;
diff --git a/core/src/main/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportStep.java b/core/src/main/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportStep.java
index de7749c4..ddfb08fd 100644
--- a/core/src/main/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportStep.java
+++ b/core/src/main/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportStep.java
@@ -13,6 +13,7 @@ public class ZeroCodeReportStep {
     private final Integer loop;
     private final String name;
     private final String url;
+    private final String method;
     private final String correlationId;
     private final String operation;
     @JsonSerialize(using = LocalDateTimeSerializer.class)
@@ -33,6 +34,7 @@ public class ZeroCodeReportStep {
             @JsonProperty("stepLoop") Integer loop,
             @JsonProperty("name") String name,
             @JsonProperty("url") String url,
+            @JsonProperty("method") String method,
             @JsonProperty("correlationId") String correlationId,
             @JsonProperty("operation") String operation,
             @JsonProperty("requestTimeStamp") LocalDateTime requestTimeStamp,
@@ -46,6 +48,7 @@ public class ZeroCodeReportStep {
         this.loop = loop;
         this.name = name;
         this.url = url;
+        this.method=method;
         this.correlationId = correlationId;
         this.operation = operation;
         this.requestTimeStamp = requestTimeStamp;
@@ -70,6 +73,10 @@ public class ZeroCodeReportStep {
         return url;
     }
 
+    public String getMethod() {
+        return method;
+    }
+
     public String getCorrelationId() {
         return correlationId;
     }
@@ -114,6 +121,7 @@ public class ZeroCodeReportStep {
                 "loop=" + loop +
                 ", name='" + name + '\'' +
                 ", url='" + url + '\'' +
+                ", method='" + method + '\'' +
                 ", correlationId='" + correlationId + '\'' +
                 ", operation='" + operation + '\'' +
                 ", requestTimeStamp=" + requestTimeStamp +
diff --git a/core/src/main/java/org/jsmart/zerocode/core/domain/reports/csv/ZeroCodeCsvReport.java b/core/src/main/java/org/jsmart/zerocode/core/domain/reports/csv/ZeroCodeCsvReport.java
index eca84061..9d694164 100644
--- a/core/src/main/java/org/jsmart/zerocode/core/domain/reports/csv/ZeroCodeCsvReport.java
+++ b/core/src/main/java/org/jsmart/zerocode/core/domain/reports/csv/ZeroCodeCsvReport.java
@@ -7,12 +7,13 @@ public class ZeroCodeCsvReport {
     private Integer stepLoop;
     private String correlationId;
     private String result;
+    private String method;
     String requestTimeStamp;
     String responseTimeStamp;
     private Double responseDelayMilliSec;
 
     public ZeroCodeCsvReport(String scenarioName, Integer scenarioLoop, String stepName, Integer stepLoop,
-                             String correlationId, String result, String requestTimeStamp,
+                             String correlationId, String result, String method, String requestTimeStamp,
                              String responseTimeStamp, Double responseDelayMilliSec) {
         this.scenarioName = scenarioName;
         this.scenarioLoop = scenarioLoop;
@@ -20,6 +21,7 @@ public class ZeroCodeCsvReport {
         this.stepLoop = stepLoop;
         this.correlationId = correlationId;
         this.result = result;
+        this.method=method;
         this.requestTimeStamp = requestTimeStamp;
         this.responseTimeStamp = responseTimeStamp;
         this.responseDelayMilliSec = responseDelayMilliSec;
@@ -49,6 +51,10 @@ public class ZeroCodeCsvReport {
         return result;
     }
 
+    public String getMethod() {
+        return method;
+    }
+
     public Double getResponseDelayMilliSec() {
         return responseDelayMilliSec;
     }
@@ -70,6 +76,7 @@ public class ZeroCodeCsvReport {
                 ", stepLoop=" + stepLoop +
                 ", correlationId='" + correlationId + '\'' +
                 ", result='" + result + '\'' +
+                ", method='" + method + '\'' +
                 ", requestTimeStamp=" + requestTimeStamp +
                 ", responseTimeStamp=" + responseTimeStamp +
                 ", responseDelayMilliSec=" + responseDelayMilliSec +
diff --git a/core/src/main/java/org/jsmart/zerocode/core/report/ZeroCodeReportGeneratorImpl.java b/core/src/main/java/org/jsmart/zerocode/core/report/ZeroCodeReportGeneratorImpl.java
index 8b774f52..dc3e6cc9 100644
--- a/core/src/main/java/org/jsmart/zerocode/core/report/ZeroCodeReportGeneratorImpl.java
+++ b/core/src/main/java/org/jsmart/zerocode/core/report/ZeroCodeReportGeneratorImpl.java
@@ -254,6 +254,7 @@ public class ZeroCodeReportGeneratorImpl implements ZeroCodeReportGenerator {
                 .addColumn("responseDelayMilliSec", CsvSchema.ColumnType.NUMBER)
                 .addColumn("responseTimeStamp")
                 .addColumn("result")
+                .addColumn("method")
                 .build();
 
         CsvMapper csvMapper = new CsvMapper();
@@ -293,6 +294,7 @@ public class ZeroCodeReportGeneratorImpl implements ZeroCodeReportGenerator {
                         csvFileBuilder.stepName(thisStep.getName());
                         csvFileBuilder.correlationId(thisStep.getCorrelationId());
                         csvFileBuilder.result(thisStep.getResult());
+                        csvFileBuilder.method(thisStep.getOperation());
                         csvFileBuilder.requestTimeStamp(thisStep.getRequestTimeStamp().toString());
                         csvFileBuilder.responseTimeStamp(thisStep.getResponseTimeStamp().toString());
                         csvFileBuilder.responseDelayMilliSec(thisStep.getResponseDelay());


Test patch:
diff --git a/core/src/test/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportTest.java b/core/src/test/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportTest.java
index 77c31a98..3eed9c75 100644
--- a/core/src/test/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportTest.java
+++ b/core/src/test/java/org/jsmart/zerocode/core/domain/reports/ZeroCodeReportTest.java
@@ -41,7 +41,7 @@ public class ZeroCodeReportTest {
                                 .loop(3)
                                 .correlationId("correlation Id")
                                 .name("step_create")
-                                .operation("POST-POST")
+                                .method("POST-POST")
                                 .url("/home/googly")
                                 .result("PASS")
                                 .build()))
@@ -53,6 +53,7 @@ public class ZeroCodeReportTest {
         assertThat(jsonNode.get("timeStamp"), is(notNullValue()));
         assertThat(jsonNode.get("results").get(0).get("loop").asInt(), is(1));
         assertThat(jsonNode.get("results").get(0).get("steps").get(0).get("loop").asInt(), is(3));
+        assertThat(jsonNode.get("results").get(0).get("steps").get(0).get("method").asText(), is("POST-POST"));
     }
 
     @Test