Repository: authorjapps/zerocode
Pull request #304 (2019-08-26 11:17:53)

ISS-283 and ISS-303 # Type cast feature  and Java vendor -Green
- Java Vendor in test reports


Patch:
diff --git a/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ExtentReportsFactory.java b/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ExtentReportsFactory.java
index 8c451a6a..59135aec 100644
--- a/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ExtentReportsFactory.java
+++ b/core/src/main/java/org/jsmart/zerocode/core/domain/builders/ExtentReportsFactory.java
@@ -38,13 +38,15 @@ public class ExtentReportsFactory {
         final String osName = systemProperties.get("os.name");
         final String osArchitecture = systemProperties.get("os.arch");
         final String javaVersion = systemProperties.get("java.version");
+        final String javaVendor = systemProperties.get("java.vendor");
 
-        LOGGER.info("Where were the tests fired? Ans: OS:{}, Architecture:{}, Java:{}",
-                osName, osArchitecture, javaVersion);
+        LOGGER.info("Where were the tests fired? Ans: OS:{}, Architecture:{}, Java:{}, Vendor:{}",
+                osName, osArchitecture, javaVersion, javaVendor);
 
         extentReports.setSystemInfo("OS : ", osName);
         extentReports.setSystemInfo("OS Architecture : ", osArchitecture);
         extentReports.setSystemInfo("Java Version : ", javaVersion);
+        extentReports.setSystemInfo("Java Vendor : ", javaVendor);
     }
 
     public static ExtentHtmlReporter createExtentHtmlReporter(String reportFileName) {
diff --git a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java
index 0bb98170..4b0ca4f5 100644
--- a/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java
+++ b/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImpl.java
@@ -1,5 +1,6 @@
 package org.jsmart.zerocode.core.engine.preprocessor;
 
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.JsonNodeType;
@@ -60,6 +61,8 @@ import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeAssertionTokens.ASS
 import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeAssertionTokens.ASSERT_VALUE_ONE_OF;
 import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeAssertionTokens.RAW_BODY;
 import static org.jsmart.zerocode.core.engine.tokens.ZeroCodeValueTokens.$VALUE;
+import static org.jsmart.zerocode.core.utils.FieldTypeConversionUtils.digTypeCast;
+import static org.jsmart.zerocode.core.utils.FieldTypeConversionUtils.fieldTypes;
 import static org.jsmart.zerocode.core.utils.TokenUtils.getTestCaseTokens;
 import static org.jsmart.zerocode.core.utils.TokenUtils.populateParamMap;
 import static org.slf4j.LoggerFactory.getLogger;
@@ -84,7 +87,8 @@ public class ZeroCodeAssertionsProcessorImpl implements ZeroCodeAssertionsProces
     @Override
     public String resolveStringJson(String requestJsonOrAnyString, String scenarioStateJson) {
         String resolvedFromTemplate = resolveKnownTokensAndProperties(requestJsonOrAnyString);
-        return resolveJsonPaths(resolvedFromTemplate, scenarioStateJson);
+        String resolvedJson = resolveJsonPaths(resolvedFromTemplate, scenarioStateJson);
+        return resolveFieldTypes(resolvedJson);
     }
 
     @Override
@@ -223,15 +227,14 @@ public class ZeroCodeAssertionsProcessorImpl implements ZeroCodeAssertionsProces
                 } else if (value instanceof String && (value.toString()).startsWith(ASSERT_LOCAL_DATETIME_AFTER)) {
                     String expected = ((String) value).substring(ASSERT_LOCAL_DATETIME_AFTER.length());
                     asserter = new FieldHasDateAfterValueAsserter(path, parseLocalDateTime(expected));
-                }else if (value instanceof String && (value.toString()).startsWith(ASSERT_LOCAL_DATETIME_BEFORE)) {
+                } else if (value instanceof String && (value.toString()).startsWith(ASSERT_LOCAL_DATETIME_BEFORE)) {
                     String expected = ((String) value).substring(ASSERT_LOCAL_DATETIME_BEFORE.length());
                     asserter = new FieldHasDateBeforeValueAsserter(path, parseLocalDateTime(expected));
-                }else if (value instanceof String && (value.toString()).startsWith(ASSERT_VALUE_ONE_OF) ||
-                        value instanceof String && (value.toString()).startsWith(ASSERT_VALUE_IS_ONE_OF) ) {
+                } else if (value instanceof String && (value.toString()).startsWith(ASSERT_VALUE_ONE_OF) ||
+                        value instanceof String && (value.toString()).startsWith(ASSERT_VALUE_IS_ONE_OF)) {
                     String expected = ((String) value).substring(ASSERT_VALUE_ONE_OF.length());
                     asserter = new FieldIsOneOfValueAsserter(path, expected);
-                }
-                else {
+                } else {
                     asserter = new FieldHasExactValueAsserter(path, value);
                 }
 
@@ -371,8 +374,8 @@ public class ZeroCodeAssertionsProcessorImpl implements ZeroCodeAssertionsProces
         return propertyKeys.contains(runTimeToken);
     }
 
-    private LocalDateTime parseLocalDateTime (String value){
-    	return LocalDateTime.parse(value, DateTimeFormatter.ISO_DATE_TIME);
+    private LocalDateTime parseLocalDateTime(String value) {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_DATE_TIME);
     }
 
     boolean isPathValueJson(Object jsonPathValue) {
@@ -389,10 +392,33 @@ public class ZeroCodeAssertionsProcessorImpl implements ZeroCodeAssertionsProces
 
     private int findArrayIndex(String thisPath, String actualPath) {
         String valueExpr = thisPath.substring(actualPath.length());
-        if($VALUE.equals(valueExpr)){
+        if ($VALUE.equals(valueExpr)) {
             return 0;
         }
-        return valueOf(substringBetween( valueExpr, "[", "]"));
+        return valueOf(substringBetween(valueExpr, "[", "]"));
     }
 
+    private String resolveFieldTypes(String resolvedJson) {
+        try {
+            if (hasNoTypeCast(resolvedJson)) {
+                return resolvedJson;
+            }
+
+            Map<String, Object> fieldMap = mapper.readValue(resolvedJson, new TypeReference<Map<String, Object>>() { });
+            digTypeCast(fieldMap);
+
+            return mapper.writeValueAsString(fieldMap);
+
+        } catch (Exception ex) {
+            LOGGER.error("Field Type conversion exception. \nDetails:" + ex);
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private boolean hasNoTypeCast(String resolvedJson) {
+        long foundCount = fieldTypes.stream().filter(thisType -> resolvedJson.contains(thisType)).count();
+        return foundCount <= 0 ? true : false;
+    }
+
+
 }
diff --git a/core/src/main/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtils.java b/core/src/main/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtils.java
new file mode 100755
index 00000000..3b821316
--- /dev/null
+++ b/core/src/main/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtils.java
@@ -0,0 +1,92 @@
+package org.jsmart.zerocode.core.utils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import org.jsmart.zerocode.core.di.provider.ObjectMapperProvider;
+import org.slf4j.LoggerFactory;
+
+public class FieldTypeConversionUtils {
+    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(FieldTypeConversionUtils.class);
+    private static ObjectMapper mapper = new ObjectMapperProvider().get();
+
+    public static final String INT = "(int)";
+    public static final String FLOAT = "(float)";
+    public static final String BOOLEAN = "(boolean)";
+    public static final String DECIMAL = "(decimal)";
+
+    public static List<String> fieldTypes = Arrays.asList(INT, FLOAT, BOOLEAN, DECIMAL);
+
+    static Function<String, Integer> integerFunction = (input) ->
+            Integer.valueOf(input.substring(INT.length()));
+
+    static Function<String, Float> floatFunction = (input) ->
+            Float.valueOf(input.substring(FLOAT.length()));
+
+    static Function<String, Float> decimalFunction = (input) ->
+            Float.valueOf(input.substring(FLOAT.length()));
+
+    static Function<String, Boolean> booleanFUnction = (input) ->
+            Boolean.valueOf(input.substring(BOOLEAN.length()));
+
+    static Map<String, Function> typeMap = new HashMap<String, Function>(){
+        {
+            put(INT, integerFunction);
+            put(FLOAT, floatFunction);
+            put(DECIMAL, decimalFunction);
+            put(BOOLEAN, booleanFUnction);
+        }
+    };
+
+    public static void digTypeCast(Map<String, Object> map) {
+
+        map.entrySet().stream().forEach(entry -> {
+
+            Object value = entry.getValue();
+
+            if (value instanceof Map) {
+                digTypeCast((Map<String, Object>) value);
+
+            } else if(value instanceof ArrayList){
+                ((ArrayList)value).forEach(thisItem -> {
+                    if (thisItem instanceof Map) {
+                        digTypeCast((Map<String, Object>) thisItem);
+                    }
+                    LOGGER.debug("ARRAY - Leaf node found = {}, checking for type value...", thisItem);
+                    replaceNodeValue(entry, thisItem);
+                });
+            }
+            else {
+                LOGGER.debug("Leaf node found = {}, checking for type value...", value);
+                replaceNodeValue(entry, value);
+            }
+        });
+    }
+
+
+    private static void replaceNodeValue(Map.Entry<String, Object> entry, Object thisItem) {
+        try{
+            if (thisItem != null && thisItem.toString().startsWith(INT)) {
+                entry.setValue((typeMap.get(INT)).apply(thisItem.toString()));
+            }
+            else if (thisItem != null && thisItem.toString().startsWith(DECIMAL)) {
+                entry.setValue((typeMap.get(DECIMAL)).apply(thisItem.toString()));
+            }
+            else if (thisItem != null && thisItem.toString().startsWith(FLOAT)) {
+                entry.setValue((typeMap.get(FLOAT)).apply(thisItem.toString()));
+            }
+            else if (thisItem != null && thisItem.toString().startsWith(BOOLEAN)) {
+                entry.setValue((typeMap.get(BOOLEAN)).apply(thisItem.toString()));
+            }
+        } catch(Exception exx){
+            String errorMsg = "Can not convert '" + entry.getValue() + "'.";
+            LOGGER.error(errorMsg + "\nException Details:" + exx);
+            throw new RuntimeException(errorMsg + exx);
+        }
+
+    }
+}


Test patch:
diff --git a/core/src/test/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImplTest.java b/core/src/test/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImplTest.java
index 494502da..4f2d06cc 100644
--- a/core/src/test/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImplTest.java
+++ b/core/src/test/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeAssertionsProcessorImplTest.java
@@ -373,7 +373,7 @@ public class ZeroCodeAssertionsProcessorImplTest {
         final HashMap<String, String> hashMap =
                 smartUtils.getMapper().readValue(resolvedRequestJson, HashMap.class);
 
-        assertThat( hashMap.get("onlineOrderId").length(), is(2));
+        assertThat(hashMap.get("onlineOrderId").length(), is(2));
     }
 
     @Test
@@ -391,7 +391,7 @@ public class ZeroCodeAssertionsProcessorImplTest {
         final HashMap<String, String> hashMap =
                 smartUtils.getMapper().readValue(resolvedRequestJson, HashMap.class);
 
-        assertThat( hashMap.get("onlineOrderId").length(), is(2));
+        assertThat(hashMap.get("onlineOrderId").length(), is(2));
     }
 
     @Test
@@ -1361,7 +1361,7 @@ public class ZeroCodeAssertionsProcessorImplTest {
                 "                \"author\": \"Nigel Rees\",\n" +
                 "                \"title\": \"Sayings of the Century\",\n" +
                 "                \"price\": 8.95\n" +
-                "            }"+
+                "            }" +
                 "        ]\n" +
                 "    }\n" +
                 "}";
diff --git a/core/src/test/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtilsTest.java b/core/src/test/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtilsTest.java
new file mode 100644
index 00000000..b6c1c741
--- /dev/null
+++ b/core/src/test/java/org/jsmart/zerocode/core/utils/FieldTypeConversionUtilsTest.java
@@ -0,0 +1,160 @@
+package org.jsmart.zerocode.core.utils;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jayway.jsonpath.JsonPath;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang.text.StrSubstitutor;
+import org.jsmart.zerocode.core.di.provider.ObjectMapperProvider;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.jsmart.zerocode.core.utils.FieldTypeConversionUtils.digTypeCast;
+import static org.junit.Assert.assertEquals;
+
+public class FieldTypeConversionUtilsTest {
+
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    ObjectMapper mapper = new ObjectMapperProvider().get();
+
+    @Test
+    public void testSubstituted_v3() throws IOException {
+        String originalJson = "{\n" +
+                "    \"found\": true,\n" +
+                "    \"currentAddress\":{\n" +
+                "      \"line1\": \"address line1\",  \n" +
+                "      \"line2\": \"address line2\"  \n" +
+                "    },\n" +
+                "    \"results\": [\n" +
+                "        {\n" +
+                "            \"id\": 1,\n" +
+                "            \"name\": \"Foo\"\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"id\": 2.35,\n" +
+                "            \"name\": \"Bar\",\n" +
+                "            \"isActive\": false\n" +
+                "        }\n" +
+                "    ]\n" +
+                "}";
+
+        String jsonViaPath = "{\n" +
+                "    \"found\": \"(boolean)${$.found}\",\n" +
+                "    \"currentAddress\":{\n" +
+                "      \"line1\": \"address line1\",\n" +
+                "      \"line2\": \"address line2\"\n" +
+                "    }," +
+                "    \"results\": [\n" +
+                "        {\n" +
+                "            \"id\": \"(int)${$.results[0].id}\",\n" +
+                "            \"name\": \"Foo - ${$.results[0].id} - ${$.found}\"\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"id\": \"(float)${$.results[1].id}\",\n" +
+                "            \"name\": \"Bar - ${$.results[1].id}\",\n" +
+                "            \"isActive\": \"(boolean)${$.results[1].isActive}\"\n" +
+                "        }\n" +
+                "    ]\n" +
+                "}";
+
+        List<String> tokens = new ArrayList<>();
+        tokens.add("$.found");
+        tokens.add("$.results[0].id");
+        tokens.add("$.results[1].id");
+        tokens.add("$.results[1].isActive");
+
+        Map<String, Object> paramMap = new HashMap<>();
+
+        tokens.forEach(thisPath -> {
+            Object pathValue = JsonPath.read(originalJson, thisPath);
+            paramMap.put(thisPath, pathValue);
+        });
+
+        StrSubstitutor sub = new StrSubstitutor(paramMap);
+        String resolvedJson = sub.replace(jsonViaPath);
+
+        Map<String, Object> stepMap = mapper.readValue(resolvedJson, new TypeReference<Map<String, Object>>() {
+        });
+
+        digTypeCast(stepMap);
+
+        JsonNode jsonNode = mapper.valueToTree(stepMap);
+
+        assertEquals(true, jsonNode.get("found").asBoolean());
+        assertEquals("{\"id\":2.35,\"name\":\"Bar - 2.35\",\"isActive\":false}",
+                jsonNode.get("results").get(1).toString());
+        assertEquals("address line1", jsonNode.get("currentAddress").get("line1").asText());
+    }
+
+    @Test
+    public void testSubstituted_incorrectTypeException() throws IOException {
+        String originalJson = "{\n" +
+                "    \"found\": true,\n" +
+                "    \"currentAddress\":{\n" +
+                "      \"line1\": \"address line1\",  \n" +
+                "      \"line2\": \"address line2\"  \n" +
+                "    },\n" +
+                "    \"results\": [\n" +
+                "        {\n" +
+                "            \"id\": 1,\n" +
+                "            \"name\": \"Foo\"\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"id\": 2.35,\n" +
+                "            \"name\": \"Bar\",\n" +
+                "            \"isActive\": false\n" +
+                "        }\n" +
+                "    ]\n" +
+                "}";
+
+        String jsonViaPath = "{\n" +
+                "    \"found\": \"(boolean)${$.found}\",\n" +
+                "    \"currentAddress\":{\n" +
+                "      \"line1\": \"address line1\",\n" +
+                "      \"line2\": \"address line2\"\n" +
+                "    }," +
+                "    \"results\": [\n" +
+                "        {\n" +
+                "            \"id\": \"(int)${$.results[0].id}\",\n" +
+                "            \"name\": \"Foo - ${$.results[0].id} - ${$.found}\"\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"id\": \"(float)${$.results[1].id}\",\n" +
+                "            \"name\": \"Bar - ${$.results[1].id}\",\n" +
+                "            \"isActive\": \"(int)${$.results[1].isActive}\"\n" +
+                "        }\n" +
+                "    ]\n" +
+                "}";
+
+        List<String> tokens = new ArrayList<>();
+        tokens.add("$.found");
+        tokens.add("$.results[0].id");
+        tokens.add("$.results[1].id");
+        tokens.add("$.results[1].isActive");
+
+        Map<String, Object> paramMap = new HashMap<>();
+
+        tokens.forEach(thisPath -> {
+            Object pathValue = JsonPath.read(originalJson, thisPath);
+            paramMap.put(thisPath, pathValue);
+        });
+
+        StrSubstitutor sub = new StrSubstitutor(paramMap);
+        String resolvedJson = sub.replace(jsonViaPath);
+
+        Map<String, Object> stepMap = mapper.readValue(resolvedJson, new TypeReference<Map<String, Object>>() {
+        });
+
+        expectedException.expectMessage("Can not convert '(int)false");
+        expectedException.expect(RuntimeException.class);
+        digTypeCast(stepMap);
+    }
+}
\ No newline at end of file
diff --git a/core/src/test/java/org/jsmart/zerocode/parameterized/ParameterizedDemoTypeCastTest.java b/core/src/test/java/org/jsmart/zerocode/parameterized/ParameterizedDemoTypeCastTest.java
new file mode 100644
index 00000000..811ff7d8
--- /dev/null
+++ b/core/src/test/java/org/jsmart/zerocode/parameterized/ParameterizedDemoTypeCastTest.java
@@ -0,0 +1,18 @@
+package org.jsmart.zerocode.parameterized;
+
+import org.jsmart.zerocode.core.domain.JsonTestCase;
+import org.jsmart.zerocode.core.domain.TargetEnv;
+import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@TargetEnv("hello_world_host.properties")
+@RunWith(TestOnlyZeroCodeUnitRunner.class)
+public class ParameterizedDemoTypeCastTest {
+
+    @Test
+    @JsonTestCase("integration_test_files/parameterized/parameterized_sample_type_cast_test.json")
+    public void testParametrize_typeCast() throws Exception {
+    }
+
+}
diff --git a/core/src/test/java/org/jsmart/zerocode/typecast/TypeCastIntegrationTest.java b/core/src/test/java/org/jsmart/zerocode/typecast/TypeCastIntegrationTest.java
new file mode 100644
index 00000000..911e0ecd
--- /dev/null
+++ b/core/src/test/java/org/jsmart/zerocode/typecast/TypeCastIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.jsmart.zerocode.typecast;
+
+import org.jsmart.zerocode.core.domain.Scenario;
+import org.jsmart.zerocode.core.domain.TargetEnv;
+import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@TargetEnv("config_hosts.properties")
+@RunWith(TestOnlyZeroCodeUnitRunner.class)
+public class TypeCastIntegrationTest {
+
+    @Test
+    @Scenario("integration_test_files/type_cast/cast_types_to_int_bool_test.json")
+    public void willPassOnlyIfCastedTo_types() throws Exception {
+
+    }
+}
+
diff --git a/core/src/test/resources/integration_test_files/parameterized/parameterized_sample_type_cast_test.json b/core/src/test/resources/integration_test_files/parameterized/parameterized_sample_type_cast_test.json
new file mode 100644
index 00000000..2b27a243
--- /dev/null
+++ b/core/src/test/resources/integration_test_files/parameterized/parameterized_sample_type_cast_test.json
@@ -0,0 +1,27 @@
+{
+    "scenarioName": "Parameterized test scenario demo Typecast",
+    "steps": [
+        {
+            "name": "get_user",
+            "url": "/home/bathroom/${0}",
+            "operation": "GET",
+            "request": {
+            },
+            "assertions": {
+                "status": 200,
+                "body": {
+                    "id": "(int)${0}",
+                    "availability": "(boolean)${1}"
+                }
+            }
+        }
+    ],
+    "parameterized": {
+        "csvSource":[
+            "1,  true",
+            "21, true"
+        ]
+    }
+
+}
+
diff --git a/core/src/test/resources/integration_test_files/type_cast/cast_types_to_int_bool_test.json b/core/src/test/resources/integration_test_files/type_cast/cast_types_to_int_bool_test.json
new file mode 100644
index 00000000..e2f6d27f
--- /dev/null
+++ b/core/src/test/resources/integration_test_files/type_cast/cast_types_to_int_bool_test.json
@@ -0,0 +1,45 @@
+{
+    "scenarioName": "cast_types_to_int_bool_test",
+    "steps": [
+        {
+            "name": "get_call",
+            "url": "http://localhost:9998/home/bathroom/1",
+            "operation": "GET",
+            "request": {
+                "headers": {
+                    "Content-Type": "application/json;charset=UTF-8",
+                    "Cookie": "cookie_123"
+                },
+                "body": {
+                }
+            },
+            "assertions": {
+                "status": 200,
+                "headers": {
+                    "Content-Type": [
+                        "application/json"
+                    ]
+                },
+                "body": {
+                    "id": "$EQ.1",
+                    "name": "Shower",
+                    "availability": true
+                }
+            }
+        },
+        {
+            "name": "another_get_call",
+            "url": "http://localhost:9998/home/bathroom/1",
+            "operation": "GET",
+            "request": {},
+            "assertions": {
+                "status": 200,
+                "body": {
+                    "id": "(int)${$.another_get_call.response.body.id}",
+                    "name": "Shower",
+                    "availability": "(boolean)${$.another_get_call.response.body.availability}"
+                }
+            }
+        }
+    ]
+}
diff --git a/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldtypecast/HelloWorldTypeCastTest.java b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldtypecast/HelloWorldTypeCastTest.java
new file mode 100644
index 00000000..1d522c02
--- /dev/null
+++ b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldtypecast/HelloWorldTypeCastTest.java
@@ -0,0 +1,18 @@
+package org.jsmart.zerocode.testhelp.tests.helloworldtypecast;
+
+import org.jsmart.zerocode.core.domain.Scenario;
+import org.jsmart.zerocode.core.domain.TargetEnv;
+import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@TargetEnv("github_host.properties")
+@RunWith(ZeroCodeUnitRunner.class)
+public class HelloWorldTypeCastTest {
+
+    @Test
+    @Scenario("parameterized_csv/hello_world_test_parameterized_csv_type_cast.json")
+    public void testParameterized_typeCast() throws Exception {
+    }
+
+}
diff --git a/http-testing/src/test/resources/parameterized_csv/hello_world_test_parameterized_csv_type_cast.json b/http-testing/src/test/resources/parameterized_csv/hello_world_test_parameterized_csv_type_cast.json
new file mode 100644
index 00000000..1bcd95fe
--- /dev/null
+++ b/http-testing/src/test/resources/parameterized_csv/hello_world_test_parameterized_csv_type_cast.json
@@ -0,0 +1,29 @@
+{
+    "scenarioName": "Parameterized and type casted example - GET API",
+    "steps": [
+        {
+            "name": "get_user_details",
+            "url": "/users/${0}",
+            "operation": "GET",
+            "request": {
+            },
+            "assertions": {
+                "status": 200,
+                "body": {
+                    "login" : "${0}",
+                    "type" : "User",
+                    "name" : "${1}",
+                    "location" : "${2}",
+                    "id" : "(int)${3}",
+                    "site_admin" : "(boolean)${4}"
+                }
+            }
+        }
+    ],
+    "parameterized": {
+        "csvSource":[
+            "octocat, The Octocat, San Francisco, 583231, false",
+            "siddhagalaxy, Sidd, UK, 33847730, false"
+        ]
+    }
+}