From bd91ebd8e51d88c846eff277e6c5a691bde5446a Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Sun, 18 Apr 2021 22:47:45 -0500 Subject: [PATCH 01/29] Execution of multiple testplan in parallel --- .../generator/ExcelToCollectionGenerator.java | 51 ++- samples/idaithalam-excel-apitesting/pom.xml | 7 +- .../test/APITestWithExcelAsRunManager.java | 26 ++ .../test/resources/get_response_empty.json | 4 +- .../virtualan_collection_pet_empty.xlsx | Bin 0 -> 5657 bytes samples/idaithalam-openapi-contract/pom.xml | 6 +- .../conf/feature/virtualan-contract.0.feature | 400 +++++++++--------- 7 files changed, 272 insertions(+), 222 deletions(-) create mode 100644 samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_empty.xlsx diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index c4f89236..2b4d774f 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -146,24 +146,40 @@ public static void createCollection(String basePath, List generatedTestC private static void getAsSingleFile(int sheet, List generatedTestCaseList, String generatedPath, Map cucumblanMap, JSONArray virtualanArray) { - for (int rowIndex = 0; rowIndex < virtualanArray.length(); rowIndex++) { - JSONObject object = virtualanArray.getJSONObject(rowIndex); - if (byEachTestCase(generatedTestCaseList, object)) { - JSONArray virtualanSingle = new JSONArray(); - virtualanSingle.put(object); + Map arrayMap = buildByMiniCategory(virtualanArray); + for (Map.Entry entry : arrayMap.entrySet()) { + JSONArray virtualanSingle = entry.getValue(); + String scenarioId = virtualanSingle.getJSONObject(0).getString("scenarioId").split("-")[0]; + if (byEachTestCase(generatedTestCaseList, scenarioId)) { CreateFileInfo createFileInfo = new CreateFileInfo(); createFileInfo.setGeneratedPath(generatedPath); createFileInfo.setCucumblanMap(cucumblanMap); createFileInfo.setVirtualanArray(virtualanSingle); createFileInfo .setTestcaseName( - "Virtualan_" + sheet + "_" + object.optString("scenarioId") + "_" + rowIndex); - createFileInfo.setScenario(object.optString("scenario")); + "Virtualan_" + sheet + "_" + scenarioId); + createFileInfo.setScenario(scenarioId); createIdaithalamProcessingFile(createFileInfo); } } } + private static Map buildByMiniCategory(JSONArray virtualanArray) { + Map arrayMap = new HashMap<>(); + for (int i = 0; i < virtualanArray.length(); i++) { + String scenarioId = virtualanArray.getJSONObject(i).getString("scenarioId").split("-")[0]; + JSONArray array = null; + if (arrayMap.containsKey(scenarioId)) { + array = arrayMap.get(scenarioId); + } else { + array = new JSONArray(); + } + array.put(virtualanArray.getJSONObject(i)); + arrayMap.put(scenarioId, array); + } + return arrayMap; + } + private static JSONArray getObjectSheet(List generatedTestCaseList, SheetObject sheetObject) throws MalformedURLException { @@ -190,12 +206,14 @@ private static JSONArray getObjectSheet(List generatedTestCaseList, return virtualanArray; } + private static boolean byEachTestCase(List generatedTestCaseList, - JSONObject row) { + String scenarioId) { return (!IdaithalamConfiguration.isWorkFlow() && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || generatedTestCaseList - .contains(row.optString("scenarioId")))); + .contains(scenarioId))); + } /** @@ -233,7 +251,8 @@ public static InputStream getInputStream(String basePath, String fileNameWithSub } if (stream == null) { log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); - throw new UnableToProcessException(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); + throw new UnableToProcessException( + " File is missing(" + basePath + ") : " + fileNameWithSubCategory); } return stream; } @@ -385,16 +404,18 @@ private static String buildObjectResponse(String basePath, Map r String body = null; if (responseFile.get("ResponseContent") != null) { body = responseFile.get("ResponseContent"); - } else if(responseFile.get("ResponseFile") != null) { + } else if (responseFile.get("ResponseFile") != null) { body = getFileAsString(basePath, responseFile.get("ResponseFile")); } if (body != null) { return body.trim(); } else { - log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + responseFile.get("ResponseContent")); + log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + + responseFile.get("ResponseContent")); } } catch (IOException e) { - log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + responseFile.get("ResponseContent")); + log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + + responseFile.get("ResponseContent")); } return null; } @@ -404,7 +425,7 @@ private static String buildObjectRequest(String basePath, Map re String body = null; if (requestFile.get("RequestContent") != null) { body = requestFile.get("RequestContent"); - } else if(requestFile.get("RequestFile") != null) { + } else if (requestFile.get("RequestFile") != null) { body = getFileAsString(basePath, requestFile.get("RequestFile")); } if (body != null) { @@ -607,7 +628,7 @@ private void createCollections(List generatedTestCaseList, int sheet, Sh throws MalformedURLException { JSONArray virtualanArray = getObjectSheet(generatedTestCaseList, sheetObject); log.info(virtualanArray.toString()); - if (IdaithalamConfiguration.isWorkFlow()) { + if (IdaithalamConfiguration.isWorkFlow() && virtualanArray.length() > 0) { CreateFileInfo createFileInfo = new CreateFileInfo(); createFileInfo.setGeneratedPath(generatedPath); createFileInfo.setCucumblanMap(cucumblanMap); diff --git a/samples/idaithalam-excel-apitesting/pom.xml b/samples/idaithalam-excel-apitesting/pom.xml index 4125a9de..e350937b 100644 --- a/samples/idaithalam-excel-apitesting/pom.xml +++ b/samples/idaithalam-excel-apitesting/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.2-SNAPSHOT + 1.2.4-SNAPSHOT 7.4.0 1.8 ${java.version} @@ -51,6 +51,11 @@ slf4j-simple ${slf4j.version} + + org.apache.commons + commons-lang3 + 3.12.0 + diff --git a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java index 98bb8ef7..458a479c 100644 --- a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java +++ b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java @@ -228,4 +228,30 @@ public void executeApiTests_6() { } } + @Test + public void executeApiTests_empty_7() { + int status =0 ; + try { + IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\\r\\\\\\\\n"); + int testPlanIndex = 7; + File f = new File(System.getProperty("user.dir") +"/target/"+testPlanIndex); + if(!f.exists()) + f.mkdir(); + ExcelToCollectionGenerator.createCollection(null, "virtualan_collection_pet_empty.xlsx", + System.getProperty("user.dir") +"/target/"+testPlanIndex); + //Generate feature and summary page html report for the selected testcase from the excel + status = IdaithalamExecutor.validateContract("Scriptlet testcase execution version 5", System.getProperty("user.dir") +"/target/"+testPlanIndex); + System.out.println(status); + if(status != 0) { + Assert.assertTrue(false); + } + Assert.assertTrue (true); + }catch (Exception e){ + System.out.println(e.getMessage()); + Assert.assertTrue(false); + } + } + + + } \ No newline at end of file diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json b/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json index e96abafe..d495bee2 100644 --- a/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json +++ b/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json @@ -8,11 +8,11 @@ "photoUrls": [ "string" ], - "status": "available", + "status": "available \r\n Testing \r\n again ", "tags": [ { "id": 201, - "name": "grey" + "name": "red" } ] } \ No newline at end of file diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_empty.xlsx b/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_empty.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..272328a756a434b7854f764ff1c3e051536831f6 GIT binary patch literal 5657 zcmai21z3}R*CwR9L%O>eEieRWNkJN9bV(y2(#=3Xx|yURjf8~cBt)f48b(j2An^@- z-%tL2@9TGVUE8zk+Bw_q-+iCwK1W9b{RTM-Ha0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Jw z1LS3XCDlfKs5X)nXJ{A9#}wjjQcMxqh^|#^)ifgGU9AV71OpbPmg?0^*eaQxe6(n9 z8jul%H9m*u)%RhNWi9gxa}N|NybJ?`+>cG}gKue*r*%8mc0XW8sM_3W%N9V8R4m)x zO?U82`lgraG>)3iTx?%TIHb4%G8x8p!q7;QSUsvS=(hh7kY-9KoO8>Dz&R&AI^<2+ ziyLnp62sngvOSGmaU8I6uQ!LvuerA05*C%F<|don#~0_A_*#Kd@{yj%hCXe5}kZ`s(A#S4d{3R@Lu+E#!w}}vD zL3zU557FASpi$-#^xFeN?69%G_})mrL8)}n$9Qz9JE0-%4pmYagb9~>Bf(L%(mT+7 z`?1cSsJq5A=!hc`r@3*3Iw~4D%I{U%_07@Ms_mcg-xhCwR=Ga^{{GKMVdjJN{YVx~I8v!M`IM=VyWc zz(xK&h3;G?{B>!kge4&#eCe D#d~Nr literal 0 HcmV?d00001 diff --git a/samples/idaithalam-openapi-contract/pom.xml b/samples/idaithalam-openapi-contract/pom.xml index 27f4bca4..88cec2ed 100644 --- a/samples/idaithalam-openapi-contract/pom.xml +++ b/samples/idaithalam-openapi-contract/pom.xml @@ -8,11 +8,11 @@ idaithalam-opeapi-contract 1.0.0-SNAPSHOT - 1.2.1 + 1.2.3 1.8 ${java.version} ${java.version} - 1.0.6 + 2.1.10 2.3.2 2.4.3 2.9.2 @@ -127,7 +127,7 @@ io.virtualan - virtualization + virtualan-plugin ${virtualan.version} diff --git a/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature b/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature index e38d7c78..25b66cc3 100644 --- a/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature +++ b/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature @@ -1,214 +1,212 @@ Feature: idaithalan.postman_collection.json - API Contract validation status + Scenario: Load initial set of data + Given Provided all the feature level parameters from file + @api + Scenario: read pet2 api - GET api call + Given a user perform a api action + When a user get application/json in /api/pets/200 resource on api + Then Verify the status code is 200 + And Verify-all /api/pets/200 api includes following in the response + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | grey | + | tags[0].id | i~201 | - Scenario: Load initial set of data - Given Provided all the feature level parameters from file + @api + Scenario: read pet1 api - GET api call + Given a user perform a api action + When a user get application/json in /api/pets/100 resource on api + Then Verify the status code is 200 + And Verify-all /api/pets/100 api includes following in the response + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | german shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | - @api - Scenario: read pet2 api - GET api call - Given a user perform a api action - When a user get application/json in /api/pets/200 resource on api - Then Verify the status code is 200 - And Verify-all /api/pets/200 api includes following in the response - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | grey | - | tags[0].id | i~201 | + @api + Scenario: update pet1 api - PUT api call + Given a user perform a api action + And add request with given header params + | Content-Type | application/json | + And Update api with given input + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | german shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | + When a user put application/json in /api/pets/100 resource on api + Then Verify the status code is 200 + And Verify-all /api/pets/100 api includes following in the response + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | german shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | - @api - Scenario: read pet1 api - GET api call - Given a user perform a api action - When a user get application/json in /api/pets/100 resource on api - Then Verify the status code is 200 - And Verify-all /api/pets/100 api includes following in the response - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | german shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | + @api + Scenario: update pet2 api - PUT api call + Given a user perform a api action + And add request with given header params + | Content-Type | application/json | + And Update api with given input + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | white gray | + | tags[0].id | i~201 | + When a user put application/json in /api/pets/200 resource on api + Then Verify the status code is 200 + And Verify-all /api/pets/200 api includes following in the response + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | white gray | + | tags[0].id | i~201 | - @api - Scenario: update pet1 api - PUT api call - Given a user perform a api action - And add request with given header params - | Content-Type | application/json | - And Update api with given input - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | german shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | - When a user put application/json in /api/pets/100 resource on api - Then Verify the status code is 200 - And Verify-all /api/pets/100 api includes following in the response - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | german shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | + @api + Scenario: create pet1 api - POST api call + Given a user perform a api action + And add request with given header params + | Content-Type | application/json | + And Create api with given input + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | German Shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | + When a user post application/json in /api/pets resource on api + Then Verify the status code is 201 + And Verify-all /api/pets api includes following in the response + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | German Shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | - @api - Scenario: update pet2 api - PUT api call - Given a user perform a api action - And add request with given header params - | Content-Type | application/json | - And Update api with given input - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | white gray | - | tags[0].id | i~201 | - When a user put application/json in /api/pets/200 resource on api - Then Verify the status code is 200 - And Verify-all /api/pets/200 api includes following in the response - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | white gray | - | tags[0].id | i~201 | + @api + Scenario: create pet2 api - POST api call + Given a user perform a api action + And add request with given header params + | Content-Type | application/json | + And Create api with given input + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | grey | + | tags[0].id | i~201 | + When a user post application/json in /api/pets resource on api + Then Verify the status code is 201 + And Verify-all /api/pets api includes following in the response + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | grey | + | tags[0].id | i~201 | - @api - Scenario: create pet1 api - POST api call - Given a user perform a api action - And add request with given header params - | Content-Type | application/json | - And Create api with given input - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | German Shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | - When a user post application/json in /api/pets resource on api - Then Verify the status code is 201 - And Verify-all /api/pets api includes following in the response - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | German Shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | + @api + Scenario: delete pet1 - DELETE api call + Given a user perform a api action + When a user delete application/json in /api/pets/100 resource on api + Then Verify the status code is 200 - @api - Scenario: create pet2 api - POST api call - Given a user perform a api action - And add request with given header params - | Content-Type | application/json | - And Create api with given input - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | grey | - | tags[0].id | i~201 | - When a user post application/json in /api/pets resource on api - Then Verify the status code is 201 - And Verify-all /api/pets api includes following in the response - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | grey | - | tags[0].id | i~201 | + @api + Scenario: delete pet2 - DELETE api call + Given a user perform a api action + When a user delete application/json in /api/pets/200 resource on api + Then Verify the status code is 200 - @api - Scenario: delete pet1 - DELETE api call - Given a user perform a api action - When a user delete application/json in /api/pets/100 resource on api - Then Verify the status code is 200 + @api + Scenario: get pet2 by tags - GET api call + Given a user perform a api action + And add request with given query params + | tags | grey | + When a user get application/json in /api/pets/findByTags resource on api + Then Verify the status code is 200 + And Verify-all /api/pets/findByTags api includes following in the response + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | grey | + | tags[0].id | i~201 | - @api - Scenario: delete pet2 - DELETE api call - Given a user perform a api action - When a user delete application/json in /api/pets/200 resource on api - Then Verify the status code is 200 + @api + Scenario: get pet1 by tags - GET api call + Given a user perform a api action + And add request with given query params + | tags | brown | + When a user get application/json in /api/pets/findByTags resource on api + Then Verify the status code is 200 + And Verify-all /api/pets/findByTags api includes following in the response + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | german shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | - @api - Scenario: get pet2 by tags - GET api call - Given a user perform a api action - And add request with given query params - | tags | grey | - When a user get application/json in /api/pets/findByTags resource on api - Then Verify the status code is 200 - And Verify-all /api/pets/findByTags api includes following in the response - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | grey | - | tags[0].id | i~201 | + @api + Scenario: get pet by status - GET api call + Given a user perform a api action + And add request with given query params + | status | available | + When a user get application/json in /api/pets/findByStatus resource on api + Then Verify the status code is 200 + And Verify-all /api/pets/findByStatus api includes following in the response + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | german shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | - @api - Scenario: get pet1 by tags - GET api call - Given a user perform a api action - And add request with given query params - | tags | brown | - When a user get application/json in /api/pets/findByTags resource on api - Then Verify the status code is 200 - And Verify-all /api/pets/findByTags api includes following in the response - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | german shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | - - @api - Scenario: get pet by status - GET api call - Given a user perform a api action - And add request with given query params - | status | available | - When a user get application/json in /api/pets/findByStatus resource on api - Then Verify the status code is 200 - And Verify-all /api/pets/findByStatus api includes following in the response - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | german shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | - - @api - Scenario: risk calculations - POST api call - Given a user perform a api action - And add request with given header params - | Content-Type | application/json | - And Create api with given input - | birthday | 1978-10-24 | - | postalCode | 60563 | - When a user post application/json in /api/riskfactor/compute resource on api - Then Verify the status code is 200 - And Verify api response with 40 includes in the response + @api + Scenario: risk calculations - POST api call + Given a user perform a api action + And add request with given header params + | Content-Type | application/json | + And Create api with given input + | birthday | 1978-10-24 | + | postalCode | 60563 | + When a user post application/json in /api/riskfactor/compute resource on api + Then Verify the status code is 200 + And Verify api response with 40 includes in the response From 800239674f65721c9a9cf8cbfe7c94ccf3c7df00 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Sun, 18 Apr 2021 22:54:55 -0500 Subject: [PATCH 02/29] Open api contract validation --- .../conf/feature/virtualan-contract.0.feature | 46 +++++++++---------- .../conf/virtualan-provider.json | 29 +++++++++++- samples/idaithalam-openapi-contract/pom.xml | 19 ++++---- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature b/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature index 9a7ff760..0fb339f7 100644 --- a/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature +++ b/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature @@ -1,24 +1,24 @@ Feature: Sample.yaml - API Contract validation status - Scenario: Load initial set of data - Given Provided all the feature level parameters from file - @sample - Scenario: Create a new sample object. - POST api call - Given a user perform a api action - And Create api with given input - | filename | Sample.yaml | - | name | Sample | - | version | 0.0.1 | - When a user post application/json in /sample resource on sample - Then Verify the status code is 201 - @sample - Scenario: Sample path - GET api call - Given a user perform a api action - And add request with given path params - | sampleId | sampleId | - When a user get application/json in /sample/validate/{sampleId} resource on sample - Then Verify the status code is 200 - And Verify-all /sample/validate/{sampleId} api includes following in the response - | sample1 | one | - | id | i~1 | - | sample3 | three | - | sample2 | two | + Scenario: Load initial set of data + Given Provided all the feature level parameters from file + @sample + Scenario: Create a new sample object. - POST api call + Given a user perform a api action + And Create api with given input + | filename | Sample.yaml | + | name | Sample | + | version | 0.0.1 | + When a user post application/json in /sample resource on sample + Then Verify the status code is 201 + @sample + Scenario: Sample path - GET api call + Given a user perform a api action + And add request with given path params + | sampleId | sampleId | + When a user get application/json in /sample/validate/{sampleId} resource on sample + Then Verify the status code is 200 + And Verify-all /sample/validate/{sampleId} api includes following in the response + | sample1 | one | + | id | i~1 | + | sample3 | three | + | sample2 | two | diff --git a/samples/idaithalam-openapi-contract/conf/virtualan-provider.json b/samples/idaithalam-openapi-contract/conf/virtualan-provider.json index 425a51d3..2a05d1d3 100644 --- a/samples/idaithalam-openapi-contract/conf/virtualan-provider.json +++ b/samples/idaithalam-openapi-contract/conf/virtualan-provider.json @@ -1 +1,28 @@ -[{"input":"{\r\n \"filename\" : \"Sample.yaml\",\r\n \"name\" : \"Sample\",\r\n \"version\" : \"0.0.1\"\r\n}","method":"POST","scenario":"Create a new sample object.","resource":"sample","availableParams":[],"type":"Response","url":"/sample","httpStatusCode":"201"},{"output":"{\r\n \"sample1\" : \"one\",\r\n \"id\" : 1,\r\n \"sample3\" : \"three\",\r\n \"sample2\" : \"two\"\r\n}","method":"GET","scenario":"Sample path","resource":"sample","availableParams":[{"parameterType":"PATH_PARAM","value":"sampleId","key":"sampleId"}],"type":"Response","url":"/sample/validate/{sampleId}","httpStatusCode":"200"}] \ No newline at end of file +[ + { + "input": "{\r\n \"filename\" : \"Sample.yaml\",\r\n \"name\" : \"Sample\",\r\n \"version\" : \"0.0.1\"\r\n}", + "method": "POST", + "scenario": "Create a new sample object.", + "resource": "sample", + "availableParams": [], + "type": "Response", + "url": "/sample", + "httpStatusCode": "201" + }, + { + "output": "{\r\n \"sample1\" : \"one\",\r\n \"id\" : 1,\r\n \"sample3\" : \"three\",\r\n \"sample2\" : \"two\"\r\n}", + "method": "GET", + "scenario": "Sample path", + "resource": "sample", + "availableParams": [ + { + "parameterType": "PATH_PARAM", + "value": "sampleId", + "key": "sampleId" + } + ], + "type": "Response", + "url": "/sample/validate/{sampleId}", + "httpStatusCode": "200" + } +] \ No newline at end of file diff --git a/samples/idaithalam-openapi-contract/pom.xml b/samples/idaithalam-openapi-contract/pom.xml index 88cec2ed..cff4860f 100644 --- a/samples/idaithalam-openapi-contract/pom.xml +++ b/samples/idaithalam-openapi-contract/pom.xml @@ -12,9 +12,9 @@ 1.8 ${java.version} ${java.version} - 2.1.10 + 1.0.7 2.3.2 - 2.4.3 + 2.3.0.RELEASE 2.9.2 2.4.7 20190722 @@ -118,16 +118,11 @@ 2.10.5.1 - - io.virtualan - idaithalam - ${idaithalam.version} - io.virtualan - virtualan-plugin + virtualization ${virtualan.version} @@ -149,6 +144,14 @@ + + io.virtualan + idaithalam + ${idaithalam.version} + + + + org.hsqldb From 4aff09b2b9f78f91b7b24ebe5f18f6bccb433115 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Sun, 18 Apr 2021 23:38:56 -0500 Subject: [PATCH 03/29] Open api contract validation --- modules/idaithalam/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 20d480e6..2d1cbc51 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -6,7 +6,7 @@ idaithalam-platform-testing 1.2.4-SNAPSHOT - 1.1.11-SNAPSHOT + 1.1.11 1.8 ${java.version} ${java.version} From 44438e8c5bbba05c939526af9d5e1380f847c423 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Sun, 18 Apr 2021 23:43:08 -0500 Subject: [PATCH 04/29] Open api contract validation --- samples/idaithalam-openapi-contract/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/idaithalam-openapi-contract/pom.xml b/samples/idaithalam-openapi-contract/pom.xml index cff4860f..33ce62cb 100644 --- a/samples/idaithalam-openapi-contract/pom.xml +++ b/samples/idaithalam-openapi-contract/pom.xml @@ -8,7 +8,7 @@ idaithalam-opeapi-contract 1.0.0-SNAPSHOT - 1.2.3 + 1.1.5 1.8 ${java.version} ${java.version} From fe9ce2d3d0f7bafe7679ea90de77ecf545f712f7 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Sun, 18 Apr 2021 23:44:20 -0500 Subject: [PATCH 05/29] [maven-release-plugin] prepare release idaithalam-project-1.2.4 --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 2d1cbc51..2c336e67 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.4-SNAPSHOT + 1.2.4 1.1.11 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.4 diff --git a/pom.xml b/pom.xml index 0521765f..9254f788 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.4-SNAPSHOT + 1.2.4 https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.4 From d1c34735e024b949595a99e6d2341c7d3f62d3a2 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Sun, 18 Apr 2021 23:44:21 -0500 Subject: [PATCH 06/29] [maven-release-plugin] prepare for next development iteration --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 2c336e67..6cb794c9 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.4 + 1.2.5-SNAPSHOT 1.1.11 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.4 + V1.0.13.1 diff --git a/pom.xml b/pom.xml index 9254f788..2398a929 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.4 + 1.2.5-SNAPSHOT https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.4 + V1.0.13.1 From c8057870ade34434ea99dcfddeb9f54b83e1c4d6 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Mon, 19 Apr 2021 20:57:59 -0500 Subject: [PATCH 07/29] Updated Security for Mini api flow --- modules/idaithalam/pom.xml | 2 +- .../generator/ExcelToCollectionGenerator.java | 14 ++++++-------- samples/idaithalam-excel-apitesting/pom.xml | 2 +- .../test/APITestWithExcelAsRunManager.java | 12 +++++++++++- .../virtualan_collection_pet_empty.xlsx | Bin 5657 -> 5896 bytes 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 6cb794c9..feb02fa6 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -6,7 +6,7 @@ idaithalam-platform-testing 1.2.5-SNAPSHOT - 1.1.11 + 1.1.12-SNAPSHOT 1.8 ${java.version} ${java.version} diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index 2b4d774f..137503ea 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -183,20 +183,19 @@ private static Map buildByMiniCategory(JSONArray virtualanArr private static JSONArray getObjectSheet(List generatedTestCaseList, SheetObject sheetObject) throws MalformedURLException { - Map row; Map headers = new HashMap<>(); JSONArray virtualanArray = new JSONArray(); for (Row nextRow : sheetObject.getFirstSheet()) { if (headers.isEmpty()) { headers = getHeader(nextRow); } else { - row = getRow(nextRow, headers); + Map finalRow = getRow(nextRow, headers); if (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || - generatedTestCaseList.contains(row.get("TestCaseName"))) { - if (row.get("Type") == null || "REST".equalsIgnoreCase(row.get("Type"))) { + generatedTestCaseList.stream().anyMatch(x -> finalRow.get("TestCaseName").contains(x))) { + if (finalRow.get("Type") == null || "REST".equalsIgnoreCase(finalRow.get("Type"))) { JSONObject object = buildRESTVirtualanCollection(sheetObject.getBasePath(), - row); - populateConfigMaps(row, sheetObject.getCucumblanMap(), + finalRow); + populateConfigMaps(finalRow, sheetObject.getCucumblanMap(), sheetObject.getExcludeResponseMap()); virtualanArray.put(object); } @@ -211,8 +210,7 @@ private static boolean byEachTestCase(List generatedTestCaseList, String scenarioId) { return (!IdaithalamConfiguration.isWorkFlow() && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() - || generatedTestCaseList - .contains(scenarioId))); + || generatedTestCaseList.stream().anyMatch(x -> scenarioId.contains(x)))); } diff --git a/samples/idaithalam-excel-apitesting/pom.xml b/samples/idaithalam-excel-apitesting/pom.xml index e350937b..24ed633c 100644 --- a/samples/idaithalam-excel-apitesting/pom.xml +++ b/samples/idaithalam-excel-apitesting/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.4-SNAPSHOT + 1.2.5-SNAPSHOT 7.4.0 1.8 ${java.version} diff --git a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java index 458a479c..709cce39 100644 --- a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java +++ b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java @@ -233,11 +233,21 @@ public void executeApiTests_empty_7() { int status =0 ; try { IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\\r\\\\\\\\n"); + //pass the spreadsheet that you want to pass to the user + IdaithalamConfiguration.setProperty("workflow","Disabled"); + List list = new ArrayList<>(); + //Add the testcaseName that List of testcases to be executed from the excel + //for the test selected execution + //list.add("PetPost"); + list.add("PetGet"); // uncomment and test again see the summary report + //list.add("PetGet-Test"); // uncomment and test again see the summary report + + int testPlanIndex = 7; File f = new File(System.getProperty("user.dir") +"/target/"+testPlanIndex); if(!f.exists()) f.mkdir(); - ExcelToCollectionGenerator.createCollection(null, "virtualan_collection_pet_empty.xlsx", + ExcelToCollectionGenerator.createCollection(list, "virtualan_collection_pet_empty.xlsx", System.getProperty("user.dir") +"/target/"+testPlanIndex); //Generate feature and summary page html report for the selected testcase from the excel status = IdaithalamExecutor.validateContract("Scriptlet testcase execution version 5", System.getProperty("user.dir") +"/target/"+testPlanIndex); diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_empty.xlsx b/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_empty.xlsx index 272328a756a434b7854f764ff1c3e051536831f6..00b8f9b6157a11fa873bb0e27fc55e760de3a1d1 100644 GIT binary patch delta 2982 zcmZ8j2{_bU7ynPPglI5%ktK{hOLmnl!q^7cLx?0JTb8J?#WajCc4B19p0Ot)!jwUl zFe6z*pOKPnDBslkJm2Si&wZYIpL?Hk&%O8D-}#-BErXIh2{)!Y&IK?rF#+Z}*t(O3 zAUfKJwF5~ZGs(dujZ<+2*I&hC%58hgxh>Gm!Ew^DvBOHHu+h;DD+KuE^K()J?U@Jf zGANTG5ApZtJP(MqbAlLf(N4UmN^lk)RqQ@mr%@U;8X0RrRZ@AS>0Gd78snc9Cm|*& zkUNx>{Z;%haXZ#`lGojrDJl&^R9+?*BI>VWID3#X_&4P(^}o2kO0WJkVx`pY4WSRc5-rmunJLWGhf4T9r9r~O&Z$cT7;(X0_oE#_Mlh&_ z&h>@MkqOb%>gd$jG&F~v>eRN0p|3vV)l;?kA$_OD0bd_aCH@TFn|FD_2H{m&(@=kU z!86Fih8GY;#%-MS&#u*9Pf|zg_!$lN47cWg;Nfs-Xc=LQU$VLX##KYjVFK#L#U#rE z?UNbM*9XgzNrVSJXpAF6#{1EnWl;Ee{C{4~&pXEMRQV$o$-CTVa}T&_n1ncpS#{>hMPXVpx0!vXY!Wi?C*Bg&z; zf({9inAur+(y_GbQL5P|9r!XcZ)UF`^`3`ity#eR%H=b})lBuDnP-Lq7!3mRzVNBb zxex>o6e_7^NfTA(o>L>;PgNCr-rvw8%;3VBk_Y5uW7(v~Vz*56La>AVGfU-Ah4fe? zStw7%zudb8;a1AwoZFHbJ0WzS;$Q6@MDDo;9VGW)U_VGbx=<=&J_g20>ZyjQb&fse zJ>GJ!OeeCsK#6H%%Q@!dU$+w|@UJJDXEXpz9p0YNaLTxI_?NXvjMlgijz2ShzLABbU}cS) zu!XqUij>*&H2Br%M6T(^b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h>go&+_Qp1?WfHRE`+Am-18~6A^qPaqd9BJ~N(T9!aS;UYEUGZe zC^2F|K%;7Ov`lO1jeWM$x*~X5t}uP3bh_V&dd_B|=tVr8!~mU9j(TeDjPgXc*`m_l$>OUidT-XQIu`e4iio)F$f%%PsDUN#78eTck+Jn8=m`RCyslJf z(GXa{^b-Ob(BQk@r>KT84!M8EDF&|flUmlW!xj9G!JS8&on|omuR#!6cvOT=Oh1-H zk$;hVq7WGf9J~t96DLgZ9cKwzW2s>W0J#6>#7}VIg?$h7BSm=r=M#IHP{a$fJqh&V zD^A$*pNz2l#2r&ZARQ0j-&xVj4v-jS3jtLR8RAgpq-`V_(4FN0Dxlv#w$=x_GJAjA)%8Ni^55m;}bjO`Tfy< E1NaxiUjP6A From 378b2c1690f505a23640d578afcfa26b6226efba Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Mon, 19 Apr 2021 22:00:41 -0500 Subject: [PATCH 08/29] Updated Security for Mini api flow --- modules/idaithalam/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index feb02fa6..1b63d129 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -6,7 +6,7 @@ idaithalam-platform-testing 1.2.5-SNAPSHOT - 1.1.12-SNAPSHOT + 1.1.12 1.8 ${java.version} ${java.version} From 2e3e7e1ee5673edce5bf4472157da92cc300d983 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Mon, 19 Apr 2021 22:01:51 -0500 Subject: [PATCH 09/29] [maven-release-plugin] prepare release idaithalam-project-1.2.5 --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 1b63d129..7ab6b3df 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.5-SNAPSHOT + 1.2.5 1.1.12 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.5 diff --git a/pom.xml b/pom.xml index 2398a929..cb66c3eb 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.5-SNAPSHOT + 1.2.5 https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.5 From 51447810b8046db36c2bcb088c2379c953b68633 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Mon, 19 Apr 2021 22:01:51 -0500 Subject: [PATCH 10/29] [maven-release-plugin] prepare for next development iteration --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 7ab6b3df..a30af8f3 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.5 + 1.2.6-SNAPSHOT 1.1.12 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.5 + V1.0.13.1 diff --git a/pom.xml b/pom.xml index cb66c3eb..21a7aa2f 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.5 + 1.2.6-SNAPSHOT https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.5 + V1.0.13.1 From cead3ebf5b42385e30978137e2d1e3585d3f2eb7 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Tue, 20 Apr 2021 18:42:14 -0500 Subject: [PATCH 11/29] Updated Workflow disable feature to enable all testcases --- .../generator/ExcelToCollectionGenerator.java | 27 +++++----- samples/idaithalam-excel-apitesting/pom.xml | 2 +- .../test/APITestWithExcelAsRunManager.java | 46 ++++++++++++++++-- .../virtualan_collection_pet_sheet_2.xlsx | Bin 0 -> 7988 bytes 4 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_sheet_2.xlsx diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index 137503ea..42ff1958 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -626,18 +626,21 @@ private void createCollections(List generatedTestCaseList, int sheet, Sh throws MalformedURLException { JSONArray virtualanArray = getObjectSheet(generatedTestCaseList, sheetObject); log.info(virtualanArray.toString()); - if (IdaithalamConfiguration.isWorkFlow() && virtualanArray.length() > 0) { - CreateFileInfo createFileInfo = new CreateFileInfo(); - createFileInfo.setGeneratedPath(generatedPath); - createFileInfo.setCucumblanMap(cucumblanMap); - createFileInfo.setVirtualanArray(virtualanArray); - createFileInfo.setTestcaseName( - "Virtualan_" + sheet + "_" + firstSheet.getSheetName().replaceAll(" ", "_") - + "_WORKFLOW_" + sheet); - createFileInfo.setScenario("WORKFLOW:" + firstSheet.getSheetName()); - createIdaithalamProcessingFile(createFileInfo); - } else { - getAsSingleFile(sheet, generatedTestCaseList, generatedPath, cucumblanMap, virtualanArray); + if(virtualanArray.length() > 0) { + if (IdaithalamConfiguration.isWorkFlow()) { + CreateFileInfo createFileInfo = new CreateFileInfo(); + createFileInfo.setGeneratedPath(generatedPath); + createFileInfo.setCucumblanMap(cucumblanMap); + createFileInfo.setVirtualanArray(virtualanArray); + createFileInfo.setTestcaseName( + "Virtualan_" + sheet + "_" + firstSheet.getSheetName().replaceAll(" ", "_") + + "_WORKFLOW_" + sheet); + createFileInfo.setScenario("WORKFLOW:" + firstSheet.getSheetName()); + createIdaithalamProcessingFile(createFileInfo); + } else { + getAsSingleFile(sheet, generatedTestCaseList, generatedPath, cucumblanMap, + virtualanArray); + } } } } diff --git a/samples/idaithalam-excel-apitesting/pom.xml b/samples/idaithalam-excel-apitesting/pom.xml index 24ed633c..91fc5cb6 100644 --- a/samples/idaithalam-excel-apitesting/pom.xml +++ b/samples/idaithalam-excel-apitesting/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.5-SNAPSHOT + 1.2.6-SNAPSHOT 7.4.0 1.8 ${java.version} diff --git a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java index 709cce39..51da4a9c 100644 --- a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java +++ b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java @@ -32,12 +32,13 @@ public void testAfterClass(){ public void executeApiTests_1(){ int status =0 ; try { - int testcase =1; + IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\\r\\\\\\\\n"); + int testcase =1; List list = new ArrayList<>(); //Add the testcaseName that List of testcases to be executed from the excel //for the test selected execution - //list.add("PetPost"); - //list.add("PetGet"); // uncomment and test again see the summary report + list.add("PetPost"); + list.add("PetGet"); // uncomment and test again see the summary report File f = new File(System.getProperty("user.dir") +"/target/"+testcase); if(!f.exists()) f.mkdir(); @@ -239,7 +240,7 @@ public void executeApiTests_empty_7() { //Add the testcaseName that List of testcases to be executed from the excel //for the test selected execution //list.add("PetPost"); - list.add("PetGet"); // uncomment and test again see the summary report + //list.add("PetGet"); // uncomment and test again see the summary report //list.add("PetGet-Test"); // uncomment and test again see the summary report @@ -264,4 +265,41 @@ public void executeApiTests_empty_7() { + @Test + public void executeApiTests_multiplesheet_8() { + int status =0 ; + try { + IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\\r\\\\\\\\n"); + //pass the spreadsheet that you want to pass to the user + IdaithalamConfiguration.setProperty("workflow","Disabled"); + List list = new ArrayList<>(); + //Add the testcaseName that List of testcases to be executed from the excel + //for the test selected execution + list.add("EDI271_1"); + list.add("EDI271"); + list.add("PetPost_3"); + //list.add("PetGet"); // uncomment and test again see the summary report + //list.add("PetGet-Test"); // uncomment and test again see the summary report + + + int testPlanIndex = 8; + File f = new File(System.getProperty("user.dir") +"/target/"+testPlanIndex); + if(!f.exists()) + f.mkdir(); + ExcelToCollectionGenerator.createCollection(list, "virtualan_collection_pet_sheet_2.xlsx", + System.getProperty("user.dir") +"/target/"+testPlanIndex); + //Generate feature and summary page html report for the selected testcase from the excel + status = IdaithalamExecutor.validateContract("Scriptlet testcase execution version 5", System.getProperty("user.dir") +"/target/"+testPlanIndex); + System.out.println(status); + if(status != 0) { + Assert.assertTrue(false); + } + Assert.assertTrue (true); + }catch (Exception e){ + System.out.println(e.getMessage()); + Assert.assertTrue(false); + } + } + + } \ No newline at end of file diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_sheet_2.xlsx b/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_pet_sheet_2.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..8d17aba617f65f0dc1ff6f2d1a034ea63078e0ca GIT binary patch literal 7988 zcmeHsbyQSuyEfh315(nR0@5ul-7w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e0Ny4Ol zZ``a4A|r*;q+UlWeMt= zDV(@T{fX521{Ekp6`Hi64yVv!s=-9DJ0yfDp37EU5)su#IAtHLPhb;syHot8c>nFhfHR=3`@USW0Zx?@C^WBQ>mf-x~o5w#deb_keyY_FhA^2~1 z{Hsm;dGSN;yzec)4dyODclZ4do#s!Rhs1Qxw7*Rd@DJYo^TLM}^-tf^-L2=}u$Zzu V{9W=vL80G$-0v8_gyjD0{{R)UT}S`` literal 0 HcmV?d00001 From c460408f52770d75ed094612fcf4ef73e0ed4aa2 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Tue, 20 Apr 2021 18:43:42 -0500 Subject: [PATCH 12/29] [maven-release-plugin] prepare release idaithalam-project-1.2.6 --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index a30af8f3..ecf7ff18 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.6-SNAPSHOT + 1.2.6 1.1.12 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.6 diff --git a/pom.xml b/pom.xml index 21a7aa2f..f74bc51c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.6-SNAPSHOT + 1.2.6 https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.6 From 3512d7aa97b76ba05314a8889f8e6ae3d4968725 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Tue, 20 Apr 2021 18:43:43 -0500 Subject: [PATCH 13/29] [maven-release-plugin] prepare for next development iteration --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index ecf7ff18..2411ab8b 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.6 + 1.2.7-SNAPSHOT 1.1.12 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.6 + V1.0.13.1 diff --git a/pom.xml b/pom.xml index f74bc51c..e991aea6 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.6 + 1.2.7-SNAPSHOT https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.6 + V1.0.13.1 From e07751aa370ee24b7aa5451777b53e4099b36a7c Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Thu, 22 Apr 2021 12:22:50 -0500 Subject: [PATCH 14/29] Updated Workflow disable feature to enable all testcases --- .../io/virtualan/idaithalam/core/api/MassApiExecutor.java | 2 +- .../core/generator/ExcelToCollectionGenerator.java | 7 ++++--- samples/idaithalam-excel-apitesting/pom.xml | 2 +- .../io/virtualan/test/APITestWithExcelAsRunManager.java | 2 +- .../src/test/resources/get_response_empty.json | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/api/MassApiExecutor.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/api/MassApiExecutor.java index 7558a4f6..1da5902a 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/api/MassApiExecutor.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/api/MassApiExecutor.java @@ -25,7 +25,7 @@ public static boolean invoke(String configMapper) throws InterruptedException { .getResourceAsStream(configMapper); ExecutionPlanner executionPlanner = yaml.load(inputStream); ExecutorService executor = Executors - .newFixedThreadPool(executionPlanner.getApiExecutor().size()); + .newFixedThreadPool(executionPlanner.getParallelExecution()); List> futures = new ArrayList<>(); executionPlanner.getApiExecutor().stream().forEach( x -> { diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index 42ff1958..52b3f864 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -185,13 +185,14 @@ private static JSONArray getObjectSheet(List generatedTestCaseList, throws MalformedURLException { Map headers = new HashMap<>(); JSONArray virtualanArray = new JSONArray(); - for (Row nextRow : sheetObject.getFirstSheet()) { + for (int i =0; i finalRow = getRow(nextRow, headers); - if (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || - generatedTestCaseList.stream().anyMatch(x -> finalRow.get("TestCaseName").contains(x))) { + if (!finalRow.isEmpty() && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || + generatedTestCaseList.stream().anyMatch(x -> finalRow.get("TestCaseName").contains(x)))) { if (finalRow.get("Type") == null || "REST".equalsIgnoreCase(finalRow.get("Type"))) { JSONObject object = buildRESTVirtualanCollection(sheetObject.getBasePath(), finalRow); diff --git a/samples/idaithalam-excel-apitesting/pom.xml b/samples/idaithalam-excel-apitesting/pom.xml index 91fc5cb6..dd936c7b 100644 --- a/samples/idaithalam-excel-apitesting/pom.xml +++ b/samples/idaithalam-excel-apitesting/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.6-SNAPSHOT + 1.2.6 7.4.0 1.8 ${java.version} diff --git a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java index 51da4a9c..4a02274c 100644 --- a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java +++ b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java @@ -233,7 +233,7 @@ public void executeApiTests_6() { public void executeApiTests_empty_7() { int status =0 ; try { - IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\\r\\\\\\\\n"); + IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\r\\\\\\\\n"); //pass the spreadsheet that you want to pass to the user IdaithalamConfiguration.setProperty("workflow","Disabled"); List list = new ArrayList<>(); diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json b/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json index d495bee2..5f91e416 100644 --- a/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json +++ b/samples/idaithalam-excel-apitesting/src/test/resources/get_response_empty.json @@ -1,14 +1,14 @@ { "category": { "id": 200, - "name": "Bulldog" + "name": "Bulldog \r\n Testing \r\n again" }, "id": 201, "name": "", "photoUrls": [ "string" ], - "status": "available \r\n Testing \r\n again ", + "status": "available", "tags": [ { "id": 201, From 23061824389957743fef53dba083b0aa3f835a56 Mon Sep 17 00:00:00 2001 From: elanj Date: Thu, 22 Apr 2021 15:03:10 -0500 Subject: [PATCH 15/29] Updated with Integration changes --- .../generator/ExcelToCollectionGenerator.java | 1220 +++++++++-------- 1 file changed, 617 insertions(+), 603 deletions(-) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index 52b3f864..a57ffffa 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -4,6 +4,7 @@ import io.virtualan.idaithalam.core.UnableToProcessException; import io.virtualan.idaithalam.core.domain.CreateFileInfo; import io.virtualan.idaithalam.core.domain.SheetObject; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -20,6 +21,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; + import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; @@ -37,612 +39,624 @@ @Slf4j public class ExcelToCollectionGenerator { - private ExcelToCollectionGenerator() { - } - - - public static String convertStreamToString(InputStream is) throws IOException { - if (is != null) { - StringBuilder sb = new StringBuilder(); - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); - - String line; - while ((line = reader.readLine()) != null) { - if (!line.trim().equalsIgnoreCase("")) { - sb.append(line).append("\n"); - } - } - } finally { - is.close(); - } - - return sb.toString(); - } else { - return null; - } - } - - /** - * Create collection. - * - * @param generatedTestCaseList the generated test case list - * @param excelFilePath the excel file path - * @param generatedPath the generated path - * @throws IOException the io exception - */ - public static void createCollection(List generatedTestCaseList, - String excelFilePath, - String generatedPath) - throws IOException, UnableToProcessException { - createCollection(null, generatedTestCaseList, - excelFilePath, - generatedPath); - - } - - private static Map getHeader(Row nextRow) { - Map headers = new HashMap<>(); - int headerIndex = 0; - for (Cell cell : nextRow) { - headers.put(headerIndex++, getCellValue(cell)); - - } - return headers; - } - - private static Map getRow(Row nextRow, Map headers) { - Map dataMap = new HashMap<>(); - for (Cell cell : nextRow) { - String key = headers.get(cell.getColumnIndex()); - dataMap.put(key, getCellValue(cell)); - } - return dataMap; - } - - /** - * Create collection. - * - * @param basePath the base path - * @param generatedTestCaseList the generated test case list - * @param excelFilePath the excel file path - * @param generatedPath the generated path - * @throws IOException the io exception - */ - public static void createCollection(String basePath, List generatedTestCaseList, - String excelFilePath, - String generatedPath) - throws IOException, UnableToProcessException { - InputStream stream = getInputStream(basePath, excelFilePath); - try { - if (stream != null) { - BuildCollections buildCollections = new BuildCollections(basePath, generatedTestCaseList, - generatedPath, stream).createCollection(); - Map excludeResponseMap = buildCollections.getExcludeResponseMap(); - Map cucumblanMap = buildCollections.getCucumblanMap(); - createPrpos(generatedPath, cucumblanMap, "cucumblan.properties"); - InputStream streamEnv = Thread.currentThread().getContextClassLoader() - .getResourceAsStream("cucumblan-env.properties"); - if (streamEnv != null) { - createPrpos(generatedPath, streamEnv, "cucumblan-env.properties"); - } - if (!excludeResponseMap.isEmpty()) { - createPrpos(generatedPath, excludeResponseMap, "exclude-response.properties"); - } - stream.close(); - } else { - log.error( - "Unable to create collection for the given excel file " + excelFilePath + " <<< "); - } - } catch (Exception e) { - log.error( - "Unable to create collection for the given excel file " + excelFilePath + " >>> " + e - .getMessage()); - } - - } - - private static void getAsSingleFile(int sheet, List generatedTestCaseList, - String generatedPath, - Map cucumblanMap, JSONArray virtualanArray) { - Map arrayMap = buildByMiniCategory(virtualanArray); - for (Map.Entry entry : arrayMap.entrySet()) { - JSONArray virtualanSingle = entry.getValue(); - String scenarioId = virtualanSingle.getJSONObject(0).getString("scenarioId").split("-")[0]; - if (byEachTestCase(generatedTestCaseList, scenarioId)) { - CreateFileInfo createFileInfo = new CreateFileInfo(); - createFileInfo.setGeneratedPath(generatedPath); - createFileInfo.setCucumblanMap(cucumblanMap); - createFileInfo.setVirtualanArray(virtualanSingle); - createFileInfo - .setTestcaseName( - "Virtualan_" + sheet + "_" + scenarioId); - createFileInfo.setScenario(scenarioId); - createIdaithalamProcessingFile(createFileInfo); - } - } - } - - private static Map buildByMiniCategory(JSONArray virtualanArray) { - Map arrayMap = new HashMap<>(); - for (int i = 0; i < virtualanArray.length(); i++) { - String scenarioId = virtualanArray.getJSONObject(i).getString("scenarioId").split("-")[0]; - JSONArray array = null; - if (arrayMap.containsKey(scenarioId)) { - array = arrayMap.get(scenarioId); - } else { - array = new JSONArray(); - } - array.put(virtualanArray.getJSONObject(i)); - arrayMap.put(scenarioId, array); - } - return arrayMap; - } - - private static JSONArray getObjectSheet(List generatedTestCaseList, - SheetObject sheetObject) - throws MalformedURLException { - Map headers = new HashMap<>(); - JSONArray virtualanArray = new JSONArray(); - for (int i =0; i finalRow = getRow(nextRow, headers); - if (!finalRow.isEmpty() && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || - generatedTestCaseList.stream().anyMatch(x -> finalRow.get("TestCaseName").contains(x)))) { - if (finalRow.get("Type") == null || "REST".equalsIgnoreCase(finalRow.get("Type"))) { - JSONObject object = buildRESTVirtualanCollection(sheetObject.getBasePath(), - finalRow); - populateConfigMaps(finalRow, sheetObject.getCucumblanMap(), - sheetObject.getExcludeResponseMap()); - virtualanArray.put(object); - } - } - } - } - return virtualanArray; - } - - - private static boolean byEachTestCase(List generatedTestCaseList, - String scenarioId) { - return (!IdaithalamConfiguration.isWorkFlow() - && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() - || generatedTestCaseList.stream().anyMatch(x -> scenarioId.contains(x)))); - - } - - /** - * Gets input stream. - * - * @param basePath the base path - * @param fileNameWithSubCategory the file name with sub category - * @return the input stream - * @throws FileNotFoundException the file not found exception - */ - public static InputStream getInputStream(String basePath, String fileNameWithSubCategory) - throws FileNotFoundException, UnableToProcessException { - InputStream stream = null; - String filePath = basePath + File.separator + fileNameWithSubCategory; - File file = new File(filePath); - File fileSub = new File(fileNameWithSubCategory); - if (file.exists()) { - stream = new FileInputStream(file); - } else if (fileSub.exists()) { - stream = new FileInputStream(fileSub); - } - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - if (stream == null) { - log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); - throw new UnableToProcessException( - " File is missing(" + basePath + ") : " + fileNameWithSubCategory); - } - return stream; - } - - /** - * Gets file as string. - * - * @param basePath the base path - * @param fileNameWithSubCategory the file name with sub category - * @return the file as string - * @throws IOException the io exception - */ - public static String getFileAsString(String basePath, String fileNameWithSubCategory) - throws IOException { - InputStream stream = null; - String filePath = basePath + File.separator + fileNameWithSubCategory; - File file = new File(filePath); - File fileSub = new File(fileNameWithSubCategory); - if (file.exists()) { - stream = new FileInputStream(file); - } else if (fileSub.exists()) { - stream = new FileInputStream(fileSub); - } - stream = getInputStream(fileNameWithSubCategory, stream, filePath); - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - if (stream == null) { - log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); - System.exit(-1); - } - return convertStreamToString(stream); - } - - private static InputStream getInputStream(String fileNameWithSubCategory, - InputStream stream, - String filePath) { - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - return stream; - } - - private static Map getCucumblan() { - Map cucumblanMap = new HashMap<>(); - cucumblanMap.put("virtualan.data.load", ""); - cucumblanMap.put("virtualan.data.heading", ""); - cucumblanMap.put("virtualan.data.type", "VIRTUALAN"); - return cucumblanMap; - } - - private static JSONObject buildRESTVirtualanCollection(String basePath, - Map dataMap) throws MalformedURLException { - JSONObject virtualanObj = new JSONObject(); - JSONArray paramsArray = new JSONArray(); - getMultiRunValue(dataMap, virtualanObj, paramsArray); - virtualanObj.put("contentType", dataMap.get("ContentType")); - buildParam("contentType", dataMap.get("ContentType"), paramsArray, "HEADER_PARAM"); - createProcessingType(dataMap, paramsArray, "FormParams", "FORM_PARAM"); - createProcessingType(dataMap, paramsArray, "RequestHeaders", "HEADER_PARAM"); - createProcessingType(dataMap, paramsArray, "ResponseProcessingType", "HEADER_PARAM"); - virtualanObj.put("scenarioId", dataMap.get("TestCaseName")); - virtualanObj.put("scenario", dataMap.get("TestCaseNameDesc")); - createProcessingType(dataMap, paramsArray, "StoreResponseVariables", "STORAGE_PARAM"); - createProcessingType(dataMap, paramsArray, "AddifyVariables", "ADDIFY_PARAM"); - createProcessingType(dataMap, paramsArray, "CookieVariables", "COOKIE_PARAM"); - getValue("Tags", dataMap, virtualanObj); - getValue("SkipScenario", dataMap, virtualanObj); - getSecurityValue(dataMap, virtualanObj); - if (dataMap.get("Action") != null) { - virtualanObj.put("method", - dataMap.get("Action").toUpperCase()); - } else { - log.error("HTTP ACTION IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); - } - if (dataMap.get("URL") != null) { - URL aURL = new URL(dataMap.get("URL")); - String resource = getResource(aURL.getPath()); - virtualanObj.put("url", aURL.getPath()); - virtualanObj.put("resource", resource); - createQueryParam(aURL.getQuery(), paramsArray); - } else { - log.error("URL IS MANDATORY!!! for " + dataMap.get("TestCaseName")); - } - if (dataMap.get("RequestFile") != null || dataMap.get("RequestContent") != null) { - virtualanObj.put("input", buildObjectRequest(basePath, dataMap)); - } - if (dataMap.get("ResponseByFields") != null) { - virtualanObj.put("outputFields", dataMap.get("ResponseByFields")); - } else if (dataMap.get("ResponseFile") != null || dataMap.get("ResponseContent") != null) { - if (dataMap.get("IncludesByPath") != null) { - virtualanObj.put("outputPaths", dataMap.get("IncludesByPath")); - } - virtualanObj.put("output", buildObjectResponse(basePath, dataMap)); - } - builHttpStausCode(dataMap, virtualanObj); - if (paramsArray.length() > 0) { - virtualanObj.put("availableParams", paramsArray); - } - return virtualanObj; - } - - private static void getSecurityValue(Map dataMap, JSONObject virtualanObj) { - String security = dataMap.get("Security"); - if (security != null && !security.isEmpty() && security.split("=").length == 2) { - virtualanObj.put("security", "okta"); - } else if (dataMap.get("Security") != null) { - virtualanObj.put("security", security); - } - - } - - private static void getValue(String key, Map dataMap, JSONObject virtualanObj) { - if (dataMap.get(key) != null) { - virtualanObj.put(key, dataMap.get(key)); - } - } - - private static void getMultiRunValue(Map dataMap, JSONObject virtualanObj, - JSONArray paramsArray) { - if (dataMap.get("MultiRun") != null) { - virtualanObj.put("MultiRun", dataMap.get("MultiRun")); - String row = dataMap.get("MultiRun").split(";")[0]; - for (String param : row.split("\\|")) { - buildParam(param, "<" + param + ">", paramsArray, "ADDIFY_PARAM"); - } - } - } - - - private static void builHttpStausCode(Map dataMap, JSONObject virtualanObj) { - if (dataMap.get("StatusCode") != null) { - virtualanObj.put("httpStatusCode", dataMap.get("StatusCode")); - } else { - log.error("HTTP STATUS CODE IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); - } - } - - private static String buildObjectResponse(String basePath, Map responseFile) { - try { - String body = null; - if (responseFile.get("ResponseContent") != null) { - body = responseFile.get("ResponseContent"); - } else if (responseFile.get("ResponseFile") != null) { - body = getFileAsString(basePath, responseFile.get("ResponseFile")); - } - if (body != null) { - return body.trim(); - } else { - log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " - + responseFile.get("ResponseContent")); - } - } catch (IOException e) { - log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " - + responseFile.get("ResponseContent")); - } - return null; - } - - private static String buildObjectRequest(String basePath, Map requestFile) { - try { - String body = null; - if (requestFile.get("RequestContent") != null) { - body = requestFile.get("RequestContent"); - } else if (requestFile.get("RequestFile") != null) { - body = getFileAsString(basePath, requestFile.get("RequestFile")); - } - if (body != null) { - return body.trim(); - } else { - log.warn("Unable to load " + requestFile + " file or content > " + requestFile); - } - } catch (IOException e) { - log.warn("Unable to load " + requestFile + " file or conten> " + requestFile); - } - return null; - } - - private static void createProcessingType(Map dataMap, - JSONArray paramsArray, String requestProcessingType, String param) { - if (dataMap.get(requestProcessingType) != null) { - String[] processTypes = dataMap.get(requestProcessingType).split(";"); - for (String keyValue : processTypes) { - String[] processType = keyValue.split("="); - if (processType.length == 2) { - buildParam(processType[0], processType[1], paramsArray, param); - } - } - } - } - - private static void createIdaithalamProcessingFile( - CreateFileInfo createFileInfo) { - String fileCreated = generateExcelJson(createFileInfo.getGeneratedPath(), - createFileInfo.getVirtualanArray(), - createFileInfo.getTestcaseName()); - if (fileCreated != null) { - String filesCreated = createFileInfo.getCucumblanMap().get("virtualan.data.load"); - createFileInfo.getCucumblanMap().put("virtualan.data.load", filesCreated + fileCreated + ";"); - String headings = createFileInfo.getCucumblanMap().get("virtualan.data.heading"); - createFileInfo.getCucumblanMap() - .put("virtualan.data.heading", headings + createFileInfo.getScenario() + ";"); - } - } - - private static String getResource(String resource) { - if (resource.split("/").length > 0) { - return resource.split("/")[1]; - } - return "default"; - } - - private static void createPrpos(String path, InputStream stream, String fileName) { - try { - Properties props = new Properties(); - //Populating the properties file - props.load(stream); - //Instantiating the FileInputStream for output file - FileOutputStream outputStrem = new FileOutputStream( - path + File.separator + fileName); - //Storing the properties file - props.store(outputStrem, "This is a " + fileName + " properties file"); - log.info(fileName + " Properties file created......"); - } catch (IOException e) { - log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); - } - } - - public static void createPrpos(String path, Map propsMap, String fileName) { - try { - Properties props = new Properties(); - //Populating the properties file - props.putAll(propsMap); - //Instantiating the FileInputStream for output file - FileOutputStream outputStrem = new FileOutputStream( - path + File.separator + fileName); - //Storing the properties file - props.store(outputStrem, "This is a " + fileName + " properties file"); - log.info(fileName + " Properties file created......"); - } catch (IOException e) { - log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); - } - } - - private static String generateExcelJson(String path, JSONArray excelArray, String fileName) { - String fileCreated = null; - try { - FileOutputStream outputStream = new FileOutputStream( - path + File.separator + fileName + ".json"); - Writer writer = new OutputStreamWriter(outputStream); - CharSequence cs = excelArray.toString(); - writer.append(cs); - writer.close(); - fileCreated = fileName + ".json"; - } catch (IOException e) { - log.warn(" Unable to generate Virtualan JSON " + fileName + " : " + e.getMessage()); - } - return fileCreated; - } - - private static void buildParam(String key, String value, JSONArray paramsArray, String param) { - JSONObject virtualanObjParam = new JSONObject(); - virtualanObjParam.put("key", key); - virtualanObjParam.put("value", value); - virtualanObjParam.put("parameterType", param); - paramsArray.put(virtualanObjParam); - } - - private static void createQueryParam(String queryString, JSONArray paramsArray) { - if (queryString != null) { - String[] querys = queryString.split("&"); - for (String query : querys) { - JSONObject virtualanObjParam = new JSONObject(); - String[] queryPart = query.split("="); - virtualanObjParam.put("key", queryPart[0]); - if (queryPart.length == 2) { - virtualanObjParam.put("value", queryPart[1]); + private ExcelToCollectionGenerator() { + } + + + public static String convertStreamToString(InputStream is) throws IOException { + if (is != null) { + StringBuilder sb = new StringBuilder(); + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); + + String line; + while ((line = reader.readLine()) != null) { + if (!line.trim().equalsIgnoreCase("")) { + sb.append(line).append("\n"); + } + } + } finally { + is.close(); + } + + return sb.toString(); } else { - virtualanObjParam.put("value", ""); + return null; } - virtualanObjParam.put("parameterType", "QUERY_PARAM"); - paramsArray.put(virtualanObjParam); - } - } - } - - private static void populateConfigMaps( - Map dataMap, Map cucumblanMap, - Map excludeResponseMap) throws MalformedURLException { - URL aURL = new URL(dataMap.get("URL")); - String resource = getResource(aURL.getPath()); - cucumblanMap.put("service.api." + resource, - aURL.getProtocol() + "://" + aURL.getAuthority()); - String okta = dataMap.get("Security"); - if (okta != null && !okta.isEmpty() && okta.split("=").length == 2) { - cucumblanMap.put("service.api.okta_token." + resource, okta.split("=")[1]); - } - if (dataMap.get("ExcludeFields") != null) { - excludeResponseMap.put(aURL.getPath(), dataMap.get("ExcludeFields")); - } - } - - private static String getCellValue(Cell cell) { - if (cell.getCellTypeEnum() != CellType.FORMULA) { - switch (cell.getCellTypeEnum()) { - case STRING: - return cell.getStringCellValue().trim(); - case BOOLEAN: - return String.valueOf(cell.getBooleanCellValue()); - case NUMERIC: - return String.valueOf((int) cell.getNumericCellValue()); - default: - return null; - } - } - return null; - } - - private static class BuildCollections { - - private final String basePath; - private final List generatedTestCaseList; - private final String generatedPath; - private final InputStream stream; - private Map excludeResponseMap; - private Map cucumblanMap; - - BuildCollections(String basePath, List generatedTestCaseList, - String generatedPath, - InputStream stream) { - this.basePath = basePath; - this.generatedTestCaseList = generatedTestCaseList; - this.generatedPath = generatedPath; - this.stream = stream; - } - - Map getExcludeResponseMap() { - return excludeResponseMap; - } - - Map getCucumblanMap() { - return cucumblanMap; - } - - - BuildCollections createCollection() throws IOException { - excludeResponseMap = new HashMap<>(); - cucumblanMap = getCucumblan(); - try (Workbook workbook = new XSSFWorkbook(stream)) { - for (int sheet = 0; sheet < workbook.getNumberOfSheets(); sheet++) { - Sheet firstSheet = workbook.getSheetAt(sheet); - SheetObject sheetObject = new SheetObject(); - sheetObject.setBasePath(basePath); - sheetObject.setExcludeResponseMap(excludeResponseMap); - sheetObject.setCucumblanMap(cucumblanMap); - sheetObject.setFirstSheet(firstSheet); - createCollections(generatedTestCaseList, sheet, firstSheet, sheetObject); - } - } - return this; - } - - private void createCollections(List generatedTestCaseList, int sheet, Sheet firstSheet, - SheetObject sheetObject) - throws MalformedURLException { - JSONArray virtualanArray = getObjectSheet(generatedTestCaseList, sheetObject); - log.info(virtualanArray.toString()); - if(virtualanArray.length() > 0) { - if (IdaithalamConfiguration.isWorkFlow()) { - CreateFileInfo createFileInfo = new CreateFileInfo(); - createFileInfo.setGeneratedPath(generatedPath); - createFileInfo.setCucumblanMap(cucumblanMap); - createFileInfo.setVirtualanArray(virtualanArray); - createFileInfo.setTestcaseName( - "Virtualan_" + sheet + "_" + firstSheet.getSheetName().replaceAll(" ", "_") - + "_WORKFLOW_" + sheet); - createFileInfo.setScenario("WORKFLOW:" + firstSheet.getSheetName()); - createIdaithalamProcessingFile(createFileInfo); + } + + /** + * Create collection. + * + * @param generatedTestCaseList the generated test case list + * @param excelFilePath the excel file path + * @param generatedPath the generated path + * @throws IOException the io exception + */ + public static void createCollection(List generatedTestCaseList, + String excelFilePath, + String generatedPath) + throws IOException, UnableToProcessException { + createCollection(null, generatedTestCaseList, + excelFilePath, + generatedPath); + + } + + private static Map getHeader(Row nextRow) { + Map headers = new HashMap<>(); + int headerIndex = 0; + for (Cell cell : nextRow) { + headers.put(headerIndex++, getCellValue(cell)); + + } + return headers; + } + + private static Map getRow(Row nextRow, Map headers) { + Map dataMap = new HashMap<>(); + if(nextRow != null) { + int lastColumn = Math.max(nextRow.getLastCellNum(), 5); + if(lastColumn > 0) { + for (Cell cell : nextRow) { + String key = headers.get(cell.getColumnIndex()); + dataMap.put(key, getCellValue(cell)); + } + } + }else { + log.error( + "Unable to process the row and row is empty >>> "); + } + return dataMap; + } + + /** + * Create collection. + * + * @param basePath the base path + * @param generatedTestCaseList the generated test case list + * @param excelFilePath the excel file path + * @param generatedPath the generated path + * @throws IOException the io exception + */ + public static void createCollection(String basePath, List generatedTestCaseList, + String excelFilePath, + String generatedPath) + throws IOException, UnableToProcessException { + try { + BuildCollections buildCollections = new BuildCollections(basePath, generatedTestCaseList, + generatedPath, excelFilePath).createCollection(); + Map excludeResponseMap = buildCollections.getExcludeResponseMap(); + Map cucumblanMap = buildCollections.getCucumblanMap(); + createPrpos(generatedPath, cucumblanMap, "cucumblan.properties"); + InputStream streamEnv = Thread.currentThread().getContextClassLoader() + .getResourceAsStream("cucumblan-env.properties"); + if (streamEnv != null) { + createPrpos(generatedPath, streamEnv, "cucumblan-env.properties"); + } + if (!excludeResponseMap.isEmpty()) { + createPrpos(generatedPath, excludeResponseMap, "exclude-response.properties"); + } + } catch (Exception e) { + log.error( + "Unable to create collection for the given excel file " + excelFilePath + " >>> " + e + .getMessage()); + } + + } + + private static void getAsSingleFile(int sheet, List generatedTestCaseList, + String generatedPath, + Map cucumblanMap, JSONArray virtualanArray) { + Map arrayMap = buildByMiniCategory(virtualanArray); + for (Map.Entry entry : arrayMap.entrySet()) { + JSONArray virtualanSingle = entry.getValue(); + String scenarioId = virtualanSingle.getJSONObject(0).getString("scenarioId").split("-")[0]; + if (byEachTestCase(generatedTestCaseList, scenarioId)) { + CreateFileInfo createFileInfo = new CreateFileInfo(); + createFileInfo.setGeneratedPath(generatedPath); + createFileInfo.setCucumblanMap(cucumblanMap); + createFileInfo.setVirtualanArray(virtualanSingle); + createFileInfo + .setTestcaseName( + "Virtualan_" + sheet + "_" + scenarioId); + createFileInfo.setScenario(scenarioId); + createIdaithalamProcessingFile(createFileInfo); + } + } + } + + private static Map buildByMiniCategory(JSONArray virtualanArray) { + Map arrayMap = new HashMap<>(); + for (int i = 0; i < virtualanArray.length(); i++) { + String scenarioId = virtualanArray.getJSONObject(i).getString("scenarioId").split("-")[0]; + JSONArray array = null; + if (arrayMap.containsKey(scenarioId)) { + array = arrayMap.get(scenarioId); + } else { + array = new JSONArray(); + } + array.put(virtualanArray.getJSONObject(i)); + arrayMap.put(scenarioId, array); + } + return arrayMap; + } + + private static JSONArray getObjectSheet(List generatedTestCaseList, + SheetObject sheetObject) + throws MalformedURLException { + Map headers = new HashMap<>(); + JSONArray virtualanArray = new JSONArray(); + for (int i = 0; i < sheetObject.getFirstSheet().getLastRowNum() ; i++) { + Row nextRow = sheetObject.getFirstSheet().getRow(i); + if (headers.isEmpty()) { + headers = getHeader(nextRow); + } else { + Map finalRow = getRow(nextRow, headers); + if (finalRow != null && !finalRow.isEmpty() && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || + generatedTestCaseList.stream().anyMatch(x -> finalRow.get("TestCaseName").contains(x)))) { + if (finalRow.get("Type") == null || "REST".equalsIgnoreCase(finalRow.get("Type"))) { + JSONObject object = buildRESTVirtualanCollection(sheetObject.getBasePath(), + finalRow); + populateConfigMaps(finalRow, sheetObject.getCucumblanMap(), + sheetObject.getExcludeResponseMap()); + virtualanArray.put(object); + } + } + } + } + return virtualanArray; + } + + + private static boolean byEachTestCase(List generatedTestCaseList, + String scenarioId) { + return (!IdaithalamConfiguration.isWorkFlow() + && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() + || generatedTestCaseList.stream().anyMatch(x -> scenarioId.contains(x)))); + + } + + /** + * Gets input stream. + * + * @param basePath the base path + * @param fileNameWithSubCategory the file name with sub category + * @return the input stream + * @throws FileNotFoundException the file not found exception + */ + public static InputStream getInputStream(String basePath, String fileNameWithSubCategory) + throws FileNotFoundException, UnableToProcessException { + InputStream stream = null; + String filePath = basePath + File.separator + fileNameWithSubCategory; + File file = new File(filePath); + File fileSub = new File(fileNameWithSubCategory); + if (file.exists()) { + stream = new FileInputStream(file); + } else if (fileSub.exists()) { + stream = new FileInputStream(fileSub); + } + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + if (stream == null) { + log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); + throw new UnableToProcessException( + " File is missing(" + basePath + ") : " + fileNameWithSubCategory); + } + return stream; + } + + /** + * Gets file as string. + * + * @param basePath the base path + * @param fileNameWithSubCategory the file name with sub category + * @return the file as string + * @throws IOException the io exception + */ + public static String getFileAsString(String basePath, String fileNameWithSubCategory) + throws IOException { + InputStream stream = null; + String filePath = basePath + File.separator + fileNameWithSubCategory; + File file = new File(filePath); + File fileSub = new File(fileNameWithSubCategory); + if (file.exists()) { + stream = new FileInputStream(file); + } else if (fileSub.exists()) { + stream = new FileInputStream(fileSub); + } + stream = getInputStream(fileNameWithSubCategory, stream, filePath); + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + if (stream == null) { + log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); + System.exit(-1); + } + return convertStreamToString(stream); + } + + private static InputStream getInputStream(String fileNameWithSubCategory, + InputStream stream, + String filePath) { + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + return stream; + } + + private static Map getCucumblan() { + Map cucumblanMap = new HashMap<>(); + cucumblanMap.put("virtualan.data.load", ""); + cucumblanMap.put("virtualan.data.heading", ""); + cucumblanMap.put("virtualan.data.type", "VIRTUALAN"); + return cucumblanMap; + } + + private static JSONObject buildRESTVirtualanCollection(String basePath, + Map dataMap) throws MalformedURLException { + JSONObject virtualanObj = new JSONObject(); + JSONArray paramsArray = new JSONArray(); + getMultiRunValue(dataMap, virtualanObj, paramsArray); + virtualanObj.put("contentType", dataMap.get("ContentType")); + buildParam("contentType", dataMap.get("ContentType"), paramsArray, "HEADER_PARAM"); + createProcessingType(dataMap, paramsArray, "FormParams", "FORM_PARAM"); + createProcessingType(dataMap, paramsArray, "RequestHeaders", "HEADER_PARAM"); + createProcessingType(dataMap, paramsArray, "ResponseProcessingType", "HEADER_PARAM"); + virtualanObj.put("scenarioId", dataMap.get("TestCaseName")); + virtualanObj.put("scenario", dataMap.get("TestCaseNameDesc")); + createProcessingType(dataMap, paramsArray, "StoreResponseVariables", "STORAGE_PARAM"); + createProcessingType(dataMap, paramsArray, "AddifyVariables", "ADDIFY_PARAM"); + createProcessingType(dataMap, paramsArray, "CookieVariables", "COOKIE_PARAM"); + getValue("Tags", dataMap, virtualanObj); + getValue("SkipScenario", dataMap, virtualanObj); + getSecurityValue(dataMap, virtualanObj); + if (dataMap.get("Action") != null) { + virtualanObj.put("method", + dataMap.get("Action").toUpperCase()); + } else { + log.error("HTTP ACTION IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); + } + if (dataMap.get("URL") != null) { + URL aURL = new URL(dataMap.get("URL")); + String resource = getResource(aURL.getPath()); + virtualanObj.put("url", aURL.getPath()); + virtualanObj.put("resource", resource); + createQueryParam(aURL.getQuery(), paramsArray); } else { - getAsSingleFile(sheet, generatedTestCaseList, generatedPath, cucumblanMap, - virtualanArray); + log.error("URL IS MANDATORY!!! for " + dataMap.get("TestCaseName")); + } + if (dataMap.get("RequestFile") != null || dataMap.get("RequestContent") != null) { + virtualanObj.put("input", buildObjectRequest(basePath, dataMap)); + } + if (dataMap.get("ResponseByFields") != null) { + virtualanObj.put("outputFields", dataMap.get("ResponseByFields")); + } else if (dataMap.get("ResponseFile") != null || dataMap.get("ResponseContent") != null) { + if (dataMap.get("IncludesByPath") != null) { + virtualanObj.put("outputPaths", dataMap.get("IncludesByPath")); + } + virtualanObj.put("output", buildObjectResponse(basePath, dataMap)); + } + builHttpStausCode(dataMap, virtualanObj); + if (paramsArray.length() > 0) { + virtualanObj.put("availableParams", paramsArray); + } + return virtualanObj; + } + + private static void getSecurityValue(Map dataMap, JSONObject virtualanObj) { + String security = dataMap.get("Security"); + if (security != null && !security.isEmpty() && security.split("=").length == 2) { + virtualanObj.put("security", "okta"); + } else if (dataMap.get("Security") != null) { + virtualanObj.put("security", security); + } + + } + + private static void getValue(String key, Map dataMap, JSONObject virtualanObj) { + if (dataMap.get(key) != null) { + virtualanObj.put(key, dataMap.get(key)); + } + } + + private static void getMultiRunValue(Map dataMap, JSONObject virtualanObj, + JSONArray paramsArray) { + if (dataMap.get("MultiRun") != null) { + virtualanObj.put("MultiRun", dataMap.get("MultiRun")); + String row = dataMap.get("MultiRun").split(";")[0]; + for (String param : row.split("\\|")) { + buildParam(param, "<" + param + ">", paramsArray, "ADDIFY_PARAM"); + } + } + } + + + private static void builHttpStausCode(Map dataMap, JSONObject virtualanObj) { + if (dataMap.get("StatusCode") != null) { + virtualanObj.put("httpStatusCode", dataMap.get("StatusCode")); + } else { + log.error("HTTP STATUS CODE IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); + } + } + + private static String buildObjectResponse(String basePath, Map responseFile) { + try { + String body = null; + if (responseFile.get("ResponseContent") != null) { + body = responseFile.get("ResponseContent"); + } else if (responseFile.get("ResponseFile") != null) { + body = getFileAsString(basePath, responseFile.get("ResponseFile")); + } + if (body != null) { + return body.trim(); + } else { + log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + + responseFile.get("ResponseContent")); + } + } catch (IOException e) { + log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + + responseFile.get("ResponseContent")); + } + return null; + } + + private static String buildObjectRequest(String basePath, Map requestFile) { + try { + String body = null; + if (requestFile.get("RequestContent") != null) { + body = requestFile.get("RequestContent"); + } else if (requestFile.get("RequestFile") != null) { + body = getFileAsString(basePath, requestFile.get("RequestFile")); + } + if (body != null) { + return body.trim(); + } else { + log.warn("Unable to load " + requestFile + " file or content > " + requestFile); + } + } catch (IOException e) { + log.warn("Unable to load " + requestFile + " file or conten> " + requestFile); + } + return null; + } + + private static void createProcessingType(Map dataMap, + JSONArray paramsArray, String requestProcessingType, String param) { + if (dataMap.get(requestProcessingType) != null) { + String[] processTypes = dataMap.get(requestProcessingType).split(";"); + for (String keyValue : processTypes) { + String[] processType = keyValue.split("="); + if (processType.length == 2) { + buildParam(processType[0], processType[1], paramsArray, param); + } + } + } + } + + private static void createIdaithalamProcessingFile( + CreateFileInfo createFileInfo) { + String fileCreated = generateExcelJson(createFileInfo.getGeneratedPath(), + createFileInfo.getVirtualanArray(), + createFileInfo.getTestcaseName()); + if (fileCreated != null) { + String filesCreated = createFileInfo.getCucumblanMap().get("virtualan.data.load"); + createFileInfo.getCucumblanMap().put("virtualan.data.load", filesCreated + fileCreated + ";"); + String headings = createFileInfo.getCucumblanMap().get("virtualan.data.heading"); + createFileInfo.getCucumblanMap() + .put("virtualan.data.heading", headings + createFileInfo.getScenario() + ";"); + } + } + + private static String getResource(String resource) { + if (resource.split("/").length > 0) { + return resource.split("/")[1]; + } + return "default"; + } + + private static void createPrpos(String path, InputStream stream, String fileName) { + try { + Properties props = new Properties(); + //Populating the properties file + props.load(stream); + //Instantiating the FileInputStream for output file + FileOutputStream outputStrem = new FileOutputStream( + path + File.separator + fileName); + //Storing the properties file + props.store(outputStrem, "This is a " + fileName + " properties file"); + log.info(fileName + " Properties file created......"); + } catch (IOException e) { + log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); + } + } + + public static void createPrpos(String path, Map propsMap, String fileName) { + try { + Properties props = new Properties(); + //Populating the properties file + props.putAll(propsMap); + //Instantiating the FileInputStream for output file + FileOutputStream outputStrem = new FileOutputStream( + path + File.separator + fileName); + //Storing the properties file + props.store(outputStrem, "This is a " + fileName + " properties file"); + log.info(fileName + " Properties file created......"); + } catch (IOException e) { + log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); + } + } + + private static String generateExcelJson(String path, JSONArray excelArray, String fileName) { + String fileCreated = null; + try { + FileOutputStream outputStream = new FileOutputStream( + path + File.separator + fileName + ".json"); + Writer writer = new OutputStreamWriter(outputStream); + CharSequence cs = excelArray.toString(); + writer.append(cs); + writer.close(); + fileCreated = fileName + ".json"; + } catch (IOException e) { + log.warn(" Unable to generate Virtualan JSON " + fileName + " : " + e.getMessage()); + } + return fileCreated; + } + + private static void buildParam(String key, String value, JSONArray paramsArray, String param) { + JSONObject virtualanObjParam = new JSONObject(); + virtualanObjParam.put("key", key); + virtualanObjParam.put("value", value); + virtualanObjParam.put("parameterType", param); + paramsArray.put(virtualanObjParam); + } + + private static void createQueryParam(String queryString, JSONArray paramsArray) { + if (queryString != null) { + String[] querys = queryString.split("&"); + for (String query : querys) { + JSONObject virtualanObjParam = new JSONObject(); + String[] queryPart = query.split("="); + virtualanObjParam.put("key", queryPart[0]); + if (queryPart.length == 2) { + virtualanObjParam.put("value", queryPart[1]); + } else { + virtualanObjParam.put("value", ""); + } + virtualanObjParam.put("parameterType", "QUERY_PARAM"); + paramsArray.put(virtualanObjParam); + } + } + } + + private static void populateConfigMaps( + Map dataMap, Map cucumblanMap, + Map excludeResponseMap) throws MalformedURLException { + URL aURL = new URL(dataMap.get("URL")); + String resource = getResource(aURL.getPath()); + cucumblanMap.put("service.api." + resource, + aURL.getProtocol() + "://" + aURL.getAuthority()); + String okta = dataMap.get("Security"); + if (okta != null && !okta.isEmpty() && okta.split("=").length == 2) { + cucumblanMap.put("service.api.okta_token." + resource, okta.split("=")[1]); + } + if (dataMap.get("ExcludeFields") != null) { + excludeResponseMap.put(aURL.getPath(), dataMap.get("ExcludeFields")); + } + } + + private static String getCellValue(Cell cell) { + if (cell.getCellTypeEnum() != CellType.FORMULA) { + switch (cell.getCellTypeEnum()) { + case STRING: + return cell.getStringCellValue().trim(); + case BOOLEAN: + return String.valueOf(cell.getBooleanCellValue()); + case NUMERIC: + return String.valueOf((int) cell.getNumericCellValue()); + default: + return null; + } + } + return null; + } + + private static class BuildCollections { + + private final String basePath; + private final List generatedTestCaseList; + private final String generatedPath; + private final String inputExcel; + private Map excludeResponseMap; + private Map cucumblanMap; + + BuildCollections(String basePath, List generatedTestCaseList, + String generatedPath, + String inputExcel) { + this.basePath = basePath; + this.generatedTestCaseList = generatedTestCaseList; + this.generatedPath = generatedPath; + this.inputExcel = inputExcel; + } + + Map getExcludeResponseMap() { + return excludeResponseMap; + } + + Map getCucumblanMap() { + return cucumblanMap; + } + + + BuildCollections createCollection() throws IOException, UnableToProcessException { + excludeResponseMap = new HashMap<>(); + cucumblanMap = getCucumblan(); + InputStream stream = getInputStream(basePath, inputExcel); + Workbook workbook = null; + try { + workbook = new XSSFWorkbook(stream); + for (int sheet = 0; sheet < workbook.getNumberOfSheets(); sheet++) { + Sheet firstSheet = workbook.getSheetAt(sheet); + SheetObject sheetObject = new SheetObject(); + sheetObject.setBasePath(basePath); + sheetObject.setExcludeResponseMap(excludeResponseMap); + sheetObject.setCucumblanMap(cucumblanMap); + sheetObject.setFirstSheet(firstSheet); + createCollections(generatedTestCaseList, sheet, firstSheet, sheetObject); + } + } catch (Exception e) { + log.error( + "Unable to create collection for the given excel file " + inputExcel + " <<< " + e.getMessage()); + } finally { + if (workbook != null) + workbook.close(); + if (stream != null) + stream.close(); + } + return this; + } + + private void createCollections(List generatedTestCaseList, int sheet, Sheet firstSheet, + SheetObject sheetObject) + throws MalformedURLException { + JSONArray virtualanArray = getObjectSheet(generatedTestCaseList, sheetObject); + log.info(virtualanArray.toString()); + if (virtualanArray.length() > 0) { + if (IdaithalamConfiguration.isWorkFlow()) { + CreateFileInfo createFileInfo = new CreateFileInfo(); + createFileInfo.setGeneratedPath(generatedPath); + createFileInfo.setCucumblanMap(cucumblanMap); + createFileInfo.setVirtualanArray(virtualanArray); + createFileInfo.setTestcaseName( + "Virtualan_" + sheet + "_" + firstSheet.getSheetName().replaceAll(" ", "_") + + "_WORKFLOW_" + sheet); + createFileInfo.setScenario("WORKFLOW:" + firstSheet.getSheetName()); + createIdaithalamProcessingFile(createFileInfo); + } else { + getAsSingleFile(sheet, generatedTestCaseList, generatedPath, cucumblanMap, + virtualanArray); + } + } } - } } - } } From 4f8b2436936a09b7120be082cc5e9db8be3a48d9 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Thu, 22 Apr 2021 19:46:24 -0500 Subject: [PATCH 16/29] Updated Workflow disable feature to enable all testcases --- .../idaithalam/core/generator/FeatureGenerationHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java index ad85c126..d9c778e6 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java @@ -401,7 +401,7 @@ private static Object getJSON(String json) { private static String replaceSpecialChar(String request){ String skipChars = IdaithalamConfiguration.getProperty("SPECIAL_SKIP_CHAR"); - skipChars = skipChars == null ? "\\|=\\\\\\\\|;" : skipChars; + skipChars = skipChars == null ? "\\|=\\\\\\\\|;\\\\n=\\\\\\\\n;" : skipChars; String replacedChar = request; for(String skipChar : skipChars.split(";") ) { replacedChar = replacedChar.replaceAll(skipChar.split("=")[0], skipChar.split("=")[1]); From c27e383ecdc70b4272bf3ecc41f725c1f700d580 Mon Sep 17 00:00:00 2001 From: elanj Date: Fri, 23 Apr 2021 07:37:17 -0500 Subject: [PATCH 17/29] Updated with Integration changes --- modules/idaithalam/pom.xml | 2 +- .../idaithalam/core/domain/Item.java | 26 +++++++++++++++++++ .../generator/ExcelToCollectionGenerator.java | 4 ++- .../generator/FeatureGenerationHelper.java | 4 +++ .../resources/virtualan-contract.mustache | 8 +++++- 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 2411ab8b..2c3d0e5a 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -6,7 +6,7 @@ idaithalam-platform-testing 1.2.7-SNAPSHOT - 1.1.12 + 1.1.13-SNAPSHOT 1.8 ${java.version} ${java.version} diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/domain/Item.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/domain/Item.java index 799840fc..33e227d1 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/domain/Item.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/domain/Item.java @@ -89,6 +89,16 @@ public class Item { */ String skipScenario; + /** + * The Csvson. + */ + String hasCsvson; + + /** + * The Csvson. + */ + List csvson; + /** * The Output file by path. */ @@ -487,6 +497,22 @@ public void setHasInputInline(String hasInputInline) { } + public List getCsvson() { + return csvson; + } + + public void setCsvson(List csvson) { + this.csvson = csvson; + } + + public String getHasCsvson() { + return hasCsvson; + } + + public void setHasCsvson(String hasCsvson) { + this.hasCsvson = hasCsvson; + } + /** * Gets std type. * diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index a57ffffa..4ef71c86 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -352,7 +352,9 @@ private static JSONObject buildRESTVirtualanCollection(String basePath, } if (dataMap.get("ResponseByFields") != null) { virtualanObj.put("outputFields", dataMap.get("ResponseByFields")); - } else if (dataMap.get("ResponseFile") != null || dataMap.get("ResponseContent") != null) { + }else if (dataMap.get("Csvson") != null) { + virtualanObj.put("csvson", dataMap.get("Csvson")); + }else if (dataMap.get("ResponseFile") != null || dataMap.get("ResponseContent") != null) { if (dataMap.get("IncludesByPath") != null) { virtualanObj.put("outputPaths", dataMap.get("IncludesByPath")); } diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java index d9c778e6..b64a67c3 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java @@ -291,6 +291,10 @@ private static void extractedScenario(JSONObject object, Item item) { private static void extractedOutput(JSONObject object, Item item, String path) throws IOException { + if(!object.optString("csvson").trim().isEmpty()) { + item.setHasCsvson(object.optString("csvson")); + item.setCsvson(Arrays.asList(object.optString("csvson").split("\n"))); + } if (object.optString("outputFields") != null && !object.optString("outputFields").isEmpty()) { item.setHasResponseByField(true); diff --git a/modules/idaithalam/src/main/resources/virtualan-contract.mustache b/modules/idaithalam/src/main/resources/virtualan-contract.mustache index 8b19f15b..0e501e2a 100644 --- a/modules/idaithalam/src/main/resources/virtualan-contract.mustache +++ b/modules/idaithalam/src/main/resources/virtualan-contract.mustache @@ -85,11 +85,17 @@ Feature: {{feature}} - API Contract validation status And Update api with given input {{/isPut}} {{#inputJsonMap}} - | {{{key}}} | {{{value}}} | + | {{{key}}} | {{{value}}} | {{/inputJsonMap}} {{/hasInputJsonMap}} When a user {{action}} {{contentType}} in {{url}} resource on {{resource}} Then Verify the status code is {{httpStatusCode}} + {{#hasCsvson}} + And Verify api response csvson includes in the response + {{#csvson}} + | {{{.}}} | + {{/csvson}} + {{/hasCsvson}} {{#stdType}} {{#outputFile}} And Verify-standard {{stdType}} all {{{outputFile}}} file {{url}} api includes following in the response From 9b1f2d54fcd15e4adff631c66578cafdae59701e Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 08:48:32 -0500 Subject: [PATCH 18/29] Updated Workflow disable feature to enable all testcases --- .../idaithalam/core/generator/FeatureGenerationHelper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java index b64a67c3..7ae2b553 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java @@ -398,6 +398,7 @@ private static Object getJSON(String json) { try { return new JSONArray(json); } catch (Exception e) { + LOGGER.warning(json + " is invalid"); return json; } } From ebe61a18e388080fb5cf8e843cb432bf2275702d Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 09:26:42 -0500 Subject: [PATCH 19/29] Updated wit \r fix --- .../idaithalam/core/generator/FeatureGenerationHelper.java | 2 +- samples/idaithalam-excel-apitesting/pom.xml | 2 +- .../java/io/virtualan/test/APITestWithExcelAsRunManager.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java index 7ae2b553..0155e98d 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java @@ -406,7 +406,7 @@ private static Object getJSON(String json) { private static String replaceSpecialChar(String request){ String skipChars = IdaithalamConfiguration.getProperty("SPECIAL_SKIP_CHAR"); - skipChars = skipChars == null ? "\\|=\\\\\\\\|;\\\\n=\\\\\\\\n;" : skipChars; + skipChars = skipChars == null ? "\\|=\\\\\\\\|;\\\\n=\\\\\\\\n;\\\\r=\\\\\\\\r;" : skipChars; String replacedChar = request; for(String skipChar : skipChars.split(";") ) { replacedChar = replacedChar.replaceAll(skipChar.split("=")[0], skipChar.split("=")[1]); diff --git a/samples/idaithalam-excel-apitesting/pom.xml b/samples/idaithalam-excel-apitesting/pom.xml index dd936c7b..a86721a2 100644 --- a/samples/idaithalam-excel-apitesting/pom.xml +++ b/samples/idaithalam-excel-apitesting/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.6 + 1.2.7-SNAPSHOT 7.4.0 1.8 ${java.version} diff --git a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java index 4a02274c..6ebbd4b5 100644 --- a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java +++ b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java @@ -233,7 +233,7 @@ public void executeApiTests_6() { public void executeApiTests_empty_7() { int status =0 ; try { - IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\r\\\\\\\\n"); + //IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\r\\\\\\\\n"); //pass the spreadsheet that you want to pass to the user IdaithalamConfiguration.setProperty("workflow","Disabled"); List list = new ArrayList<>(); From 477ff3ed18e8e41d5928d139abf68549bc0c020a Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 09:39:12 -0500 Subject: [PATCH 20/29] Updated Workflow disable feature to enable all testcases --- modules/idaithalam/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 2c3d0e5a..1aa0e008 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -6,7 +6,7 @@ idaithalam-platform-testing 1.2.7-SNAPSHOT - 1.1.13-SNAPSHOT + 1.1.13 1.8 ${java.version} ${java.version} From d99d197fc155df372645d5dc63bb79ad0e9cd8ab Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 09:40:29 -0500 Subject: [PATCH 21/29] [maven-release-plugin] prepare release idaithalam-project-1.2.7 --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 1aa0e008..9e2282e0 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.7-SNAPSHOT + 1.2.7 1.1.13 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.7 diff --git a/pom.xml b/pom.xml index e991aea6..441f1e8c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.7-SNAPSHOT + 1.2.7 https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + idaithalam-project-1.2.7 From 6a2b5ccf939fbb436e7bc410fa1aac19fb360143 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 09:40:30 -0500 Subject: [PATCH 22/29] [maven-release-plugin] prepare for next development iteration --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 9e2282e0..ad25e9d4 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.7 + 1.2.8-SNAPSHOT 1.1.13 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.7 + V1.0.13.1 diff --git a/pom.xml b/pom.xml index 441f1e8c..7fb1bbe5 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.7 + 1.2.8-SNAPSHOT https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - idaithalam-project-1.2.7 + V1.0.13.1 From c36edb6ce1b62d4d7a690c7134ddeaa9bfca000e Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 10:00:54 -0500 Subject: [PATCH 23/29] Updated Workflow disable feature to enable all testcases --- modules/idaithalam/pom.xml | 2 +- .../generator/ExcelToCollectionGenerator.java | 2 +- pom.xml | 2 +- samples/idaithalam-excel-apitesting/pom.xml | 2 +- .../virtualan_collection_testcase_6.xlsx | Bin 5560 -> 5614 bytes .../idaithalam-massapibatch-testing/pom.xml | 2 +- .../conf/feature/virtualan-contract.0.feature | 37 ++++------ .../conf/virtualan-provider.json | 29 +------- .../conf/feature/virtualan-contract.0.feature | 68 +++++++++--------- .../idaithalam-postmancoll-apitesting/pom.xml | 2 +- 10 files changed, 55 insertions(+), 91 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index ad25e9d4..1aa0e008 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.8-SNAPSHOT + 1.2.7-SNAPSHOT 1.1.13 1.8 diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index 4ef71c86..fbf118d9 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -188,7 +188,7 @@ private static JSONArray getObjectSheet(List generatedTestCaseList, throws MalformedURLException { Map headers = new HashMap<>(); JSONArray virtualanArray = new JSONArray(); - for (int i = 0; i < sheetObject.getFirstSheet().getLastRowNum() ; i++) { + for (int i = 0; i <= sheetObject.getFirstSheet().getLastRowNum() ; i++) { Row nextRow = sheetObject.getFirstSheet().getRow(i); if (headers.isEmpty()) { headers = getHeader(nextRow); diff --git a/pom.xml b/pom.xml index 7fb1bbe5..e991aea6 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ idaithalam-project pom idaithalam-project - 1.2.8-SNAPSHOT + 1.2.7-SNAPSHOT https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git diff --git a/samples/idaithalam-excel-apitesting/pom.xml b/samples/idaithalam-excel-apitesting/pom.xml index a86721a2..00f0d78e 100644 --- a/samples/idaithalam-excel-apitesting/pom.xml +++ b/samples/idaithalam-excel-apitesting/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.7-SNAPSHOT + 1.2.7 7.4.0 1.8 ${java.version} diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testcase_6.xlsx b/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testcase_6.xlsx index b7c3893b9a947a7c031cc94ca43c0eff8ea97846..6f1a89e29968a6ba6be47e78bc800e1d959807cc 100644 GIT binary patch delta 2513 zcmZ8jXH*jg7flQsDI;Nqus1Rak)^F+3bK(QD}W*fL)a!E5Q2!1luZaTD2Qx9fr1Fi z2%~Id2!@U9q97CzM6h~#&iD27{d@1e`{%uL&%I5m+p1tYOAreL003|R(8+j*?6aeV zQR!fWpxjqt0f2_Exyq8ScQE(@7m#`}_k21^ii7>9p;8>RdpJE!mGlNN-lq!jm5th) zj9Vp2Th`d^)s3L5Lrs$S=>n1reAU}ri^{~xAiNWz1G@7P9ts=7? ztYXm74Q1Lw9ASbn*)kVKCCZB@v9Bfw#J>a>ITnmJuk{ZLV)7*sieFL-a50^8!6!ox zg?6hh*(LDuD!gx-%6{D^&J*$(VM_x1`&{)+z{?;`m8o6-XFvb|Pvu~Rkv!2enh@f` zQ%!>H3Ph*pb_);F2vn?{+>-4OuP|pIR`+-lxxTz$yDb89rYkOmJqf$Bqwf$B_TH*7 zA!eGHp|++!(0--tcZ}u1+b6dqUE}4R2=urrF*(!b9Cx@(`X6tp(cb_0%K)K@^!XV9 z^yo=<#s~6O#bNvHLa-iAf)wD3^w?nO9(f(Q4~%2L0C(cOR*%@{IWewIg*9B2VhA_R zxX4k%jtZ5-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ing/pom.xml index 3237abaf..03815f04 100644 --- a/samples/idaithalam-massapibatch-testing/pom.xml +++ b/samples/idaithalam-massapibatch-testing/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.4-SNAPSHOT + 1.2.7 1.8 7.4.0 ${java.version} diff --git a/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature b/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature index 0fb339f7..850fa672 100644 --- a/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature +++ b/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature @@ -1,24 +1,15 @@ Feature: Sample.yaml - API Contract validation status - Scenario: Load initial set of data - Given Provided all the feature level parameters from file - @sample - Scenario: Create a new sample object. - POST api call - Given a user perform a api action - And Create api with given input - | filename | Sample.yaml | - | name | Sample | - | version | 0.0.1 | - When a user post application/json in /sample resource on sample - Then Verify the status code is 201 - @sample - Scenario: Sample path - GET api call - Given a user perform a api action - And add request with given path params - | sampleId | sampleId | - When a user get application/json in /sample/validate/{sampleId} resource on sample - Then Verify the status code is 200 - And Verify-all /sample/validate/{sampleId} api includes following in the response - | sample1 | one | - | id | i~1 | - | sample3 | three | - | sample2 | two | + Scenario: Load initial set of data + Given Provided all the feature level parameters from file + @sample + Scenario: Create a new sample object. - POST api call + Given a user perform a api action + When a user post application/json in /sample resource on sample + Then Verify the status code is 201 + @sample + Scenario: Sample path - GET api call + Given a user perform a api action + And add request with given path params + | sampleId | sampleId | + When a user get application/json in /sample/validate/{sampleId} resource on sample + Then Verify the status code is 200 diff --git a/samples/idaithalam-openapi-contract/conf/virtualan-provider.json b/samples/idaithalam-openapi-contract/conf/virtualan-provider.json index 2a05d1d3..c9f1ef61 100644 --- a/samples/idaithalam-openapi-contract/conf/virtualan-provider.json +++ b/samples/idaithalam-openapi-contract/conf/virtualan-provider.json @@ -1,28 +1 @@ -[ - { - "input": "{\r\n \"filename\" : \"Sample.yaml\",\r\n \"name\" : \"Sample\",\r\n \"version\" : \"0.0.1\"\r\n}", - "method": "POST", - "scenario": "Create a new sample object.", - "resource": "sample", - "availableParams": [], - "type": "Response", - "url": "/sample", - "httpStatusCode": "201" - }, - { - "output": "{\r\n \"sample1\" : \"one\",\r\n \"id\" : 1,\r\n \"sample3\" : \"three\",\r\n \"sample2\" : \"two\"\r\n}", - "method": "GET", - "scenario": "Sample path", - "resource": "sample", - "availableParams": [ - { - "parameterType": "PATH_PARAM", - "value": "sampleId", - "key": "sampleId" - } - ], - "type": "Response", - "url": "/sample/validate/{sampleId}", - "httpStatusCode": "200" - } -] \ No newline at end of file +[{"input":"","method":"POST","scenario":"Create a new sample object.","resource":"sample","availableParams":[],"type":"Response","url":"/sample","httpStatusCode":"201"},{"output":"","method":"GET","scenario":"Sample path","resource":"sample","availableParams":[{"parameterType":"PATH_PARAM","value":"sampleId","key":"sampleId"}],"type":"Response","url":"/sample/validate/{sampleId}","httpStatusCode":"200"}] \ No newline at end of file diff --git a/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature b/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature index 25b66cc3..1e0c6858 100644 --- a/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature +++ b/samples/idaithalam-postmancoll-apitesting/conf/feature/virtualan-contract.0.feature @@ -37,14 +37,14 @@ Feature: idaithalan.postman_collection.json - API Contract validation status And add request with given header params | Content-Type | application/json | And Update api with given input - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | german shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | german shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | When a user put application/json in /api/pets/100 resource on api Then Verify the status code is 200 And Verify-all /api/pets/100 api includes following in the response @@ -63,14 +63,14 @@ Feature: idaithalan.postman_collection.json - API Contract validation status And add request with given header params | Content-Type | application/json | And Update api with given input - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | white gray | - | tags[0].id | i~201 | + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | white gray | + | tags[0].id | i~201 | When a user put application/json in /api/pets/200 resource on api Then Verify the status code is 200 And Verify-all /api/pets/200 api includes following in the response @@ -89,14 +89,14 @@ Feature: idaithalan.postman_collection.json - API Contract validation status And add request with given header params | Content-Type | application/json | And Create api with given input - | photoUrls[0] | string | - | name | Rocky | - | id | i~101 | - | category.name | German Shepherd | - | category.id | i~100 | - | status | available | - | tags[0].name | brown | - | tags[0].id | i~101 | + | photoUrls[0] | string | + | name | Rocky | + | id | i~101 | + | category.name | German Shepherd | + | category.id | i~100 | + | status | available | + | tags[0].name | brown | + | tags[0].id | i~101 | When a user post application/json in /api/pets resource on api Then Verify the status code is 201 And Verify-all /api/pets api includes following in the response @@ -115,14 +115,14 @@ Feature: idaithalan.postman_collection.json - API Contract validation status And add request with given header params | Content-Type | application/json | And Create api with given input - | photoUrls[0] | string | - | name | Butch | - | id | i~201 | - | category.name | Bulldog | - | category.id | i~200 | - | status | available | - | tags[0].name | grey | - | tags[0].id | i~201 | + | photoUrls[0] | string | + | name | Butch | + | id | i~201 | + | category.name | Bulldog | + | category.id | i~200 | + | status | available | + | tags[0].name | grey | + | tags[0].id | i~201 | When a user post application/json in /api/pets resource on api Then Verify the status code is 201 And Verify-all /api/pets api includes following in the response @@ -204,8 +204,8 @@ Feature: idaithalan.postman_collection.json - API Contract validation status And add request with given header params | Content-Type | application/json | And Create api with given input - | birthday | 1978-10-24 | - | postalCode | 60563 | + | birthday | 1978-10-24 | + | postalCode | 60563 | When a user post application/json in /api/riskfactor/compute resource on api Then Verify the status code is 200 And Verify api response with 40 includes in the response diff --git a/samples/idaithalam-postmancoll-apitesting/pom.xml b/samples/idaithalam-postmancoll-apitesting/pom.xml index 56bf6600..9b0dc368 100644 --- a/samples/idaithalam-postmancoll-apitesting/pom.xml +++ b/samples/idaithalam-postmancoll-apitesting/pom.xml @@ -6,7 +6,7 @@ idaithalam-postmancoll-apitesting 1.0.1-SNAPSHOT - 1.2.2-SNAPSHOT + 1.2.7 1.8 ${java.version} ${java.version} From 2b9666acd4a2f24a96efbe846a3ed79485863407 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 10:02:54 -0500 Subject: [PATCH 24/29] [maven-release-plugin] prepare release v1.2.7.1 --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 1aa0e008..3aa56880 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.7-SNAPSHOT + 1.2.7 1.1.13 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + v1.2.7.1 diff --git a/pom.xml b/pom.xml index e991aea6..cf642ab9 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.7-SNAPSHOT + 1.2.7 https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - V1.0.13.1 + v1.2.7.1 From 3ca627da34567d7c1d69a5970e1a7b1def9a9a18 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 10:02:55 -0500 Subject: [PATCH 25/29] [maven-release-plugin] prepare for next development iteration --- modules/idaithalam/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/idaithalam/pom.xml b/modules/idaithalam/pom.xml index 3aa56880..ad25e9d4 100644 --- a/modules/idaithalam/pom.xml +++ b/modules/idaithalam/pom.xml @@ -4,7 +4,7 @@ idaithalam jar idaithalam-platform-testing - 1.2.7 + 1.2.8-SNAPSHOT 1.1.13 1.8 @@ -24,7 +24,7 @@ scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - v1.2.7.1 + V1.0.13.1 diff --git a/pom.xml b/pom.xml index cf642ab9..7fb1bbe5 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ idaithalam-project pom idaithalam-project - 1.2.7 + 1.2.8-SNAPSHOT https://virtualan.io scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git scm:git:ssh://git@github.com/virtualansoftware/idaithalam.git https://github.com/virtualansoftware/idaithalam.git - v1.2.7.1 + V1.0.13.1 From b20a20e7530b21d948d44a4ff7b93f301244d284 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 11:57:11 -0500 Subject: [PATCH 26/29] Updated wit \r fix --- .../generator/ExcelToCollectionGenerator.java | 3 --- .../api-testing.xml | 1 + .../test/APITestWithExcelAsRunManager.java | 3 +-- .../virtualan_collection_testcase_6.xlsx | Bin 5614 -> 5572 bytes .../virtualan_collection_testcase_8.xlsx | Bin 8168 -> 8181 bytes 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index fbf118d9..f8b0d784 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -104,9 +104,6 @@ private static Map getRow(Row nextRow, Map head dataMap.put(key, getCellValue(cell)); } } - }else { - log.error( - "Unable to process the row and row is empty >>> "); } return dataMap; } diff --git a/samples/idaithalam-excel-apitesting/api-testing.xml b/samples/idaithalam-excel-apitesting/api-testing.xml index 93d3420c..498b31ee 100644 --- a/samples/idaithalam-excel-apitesting/api-testing.xml +++ b/samples/idaithalam-excel-apitesting/api-testing.xml @@ -12,6 +12,7 @@ + diff --git a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java index 6ebbd4b5..999933e3 100644 --- a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java +++ b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java @@ -269,7 +269,6 @@ public void executeApiTests_empty_7() { public void executeApiTests_multiplesheet_8() { int status =0 ; try { - IdaithalamConfiguration.setProperty("SPECIAL_SKIP_CHAR","\\\\r\\\\n=\\\\\\\\r\\\\\\\\n"); //pass the spreadsheet that you want to pass to the user IdaithalamConfiguration.setProperty("workflow","Disabled"); List list = new ArrayList<>(); @@ -286,7 +285,7 @@ public void executeApiTests_multiplesheet_8() { File f = new File(System.getProperty("user.dir") +"/target/"+testPlanIndex); if(!f.exists()) f.mkdir(); - ExcelToCollectionGenerator.createCollection(list, "virtualan_collection_pet_sheet_2.xlsx", + ExcelToCollectionGenerator.createCollection(list, "virtualan_collection_testcase_8.xlsx", System.getProperty("user.dir") +"/target/"+testPlanIndex); //Generate feature and summary page html report for the selected testcase from the excel status = IdaithalamExecutor.validateContract("Scriptlet testcase execution version 5", System.getProperty("user.dir") +"/target/"+testPlanIndex); diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testcase_6.xlsx b/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testc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I+K~vU{7!?vb8fD$raF;Z^MKaYJbwx>nbwL9Kb=Nu5@?)L#y0csnq*79lHx{ zyIB;uPO0=dZ;|mRRb8<0i0(xc#(2Rjz9+I9&J!HbqYq>^=M(SYW-HXhcmzvYj!TJj z@H50mUK?Ag&6kw!)Wv+2#d93tKy8whAax`JOeA4t6wUZZ^^syW;1cy2lWPLIzxTc+Iu7L=zn zpplf7zZMDQ@pgbk&?)^t<_dQm+XGgx=Yo<#RmE08ZXV=TLH*l{QT;rsUq(50r*D58 zG{}PnRgl|p1|J96MS*rzp*Of3=6@AoUX{)JTNuooOgCtT1d`q|dbF6jFGbbhvm|-S z%MIXi_Au^_;6cUa#3Un}8eunysj1;KiJ3{bP2wRV+`2}ui9DJj8u8Rp$ZZpOHj#dl zn4831lXz)Kqaj~f5G~JZ3o>XTUrof;oPBFSG;6=Ln6K^eq6Mio8Oo*^7k{1Ol%3<4 znKiQ~Er{mAG()^PqIo&XkX{|pjCyd)?$MU`)PiVz{9=~tXm-CAh`Q<7TK~PZ2xyzJ zXhFPor`^(N*W4Ygu8D~lPP><#b}u{aUUs?#(VaHSHJo-obh<@Ace(}9ord*C@sv`6_$1>V#_$ur9b_=qSHVD@L6on9s^l`DHr(1G5wp bWC9A9PfeB^0{{Ts3X_5rJO(}!00000H!73Q diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testcase_8.xlsx b/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testcase_8.xlsx index acf395529b4fb9461826a36d837217b789ad9bb3..c716b78cef8a829ee9a340f74c906ac090d274da 100644 GIT binary patch delta 2904 zcmV-e3#atxKlMMbO$G_6pfSST0ssJ&lU4>Ee^c5(5dPj@k;!)wg1l%YC`GZ%I4vX5 zFOI_;cT2dM+@*ILl>Yi&0$L|8+EPEtFh_28Z#Vbsv&;5R9^=SbgVJ0I-}aoQZGoVY zaS{6Vbuexm+LlHl7>T3+-`;?>PX?d*TBAi}D$utNjY%r_≦mLAz&L#;wr4y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pORZs`rV<1dCaFv7W~=<)};v1NT3^vE8?{18MmpxJJAG$y$p7mK3S4IrX_lCI8y!V zx{h(0gAnupK&ZD=AnKvFYaq^_iv^bpWM=%m4*;q^0*J;ra;Z~(R>UWfqWB)MU@ zb}$1@l#?09c;(;0J)8u$0_?wc;r|W)6uILfxWzdByEp&#Eug>8#h>-Lgj?ihrm^Gr GWBw1g{&Wif From cf6a9b4423beadc9555479ad80eb1ec36c5d3dad Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 20:30:01 -0500 Subject: [PATCH 27/29] Add useful information for the error message --- .../generator/ExcelToCollectionGenerator.java | 1250 +++++++++-------- .../generator/FeatureGenerationHelper.java | 4 +- 2 files changed, 640 insertions(+), 614 deletions(-) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index f8b0d784..dca98690 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -4,7 +4,6 @@ import io.virtualan.idaithalam.core.UnableToProcessException; import io.virtualan.idaithalam.core.domain.CreateFileInfo; import io.virtualan.idaithalam.core.domain.SheetObject; - import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -21,8 +20,8 @@ import java.util.List; import java.util.Map; import java.util.Properties; - import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; @@ -39,623 +38,648 @@ @Slf4j public class ExcelToCollectionGenerator { - private ExcelToCollectionGenerator() { - } - - - public static String convertStreamToString(InputStream is) throws IOException { - if (is != null) { - StringBuilder sb = new StringBuilder(); - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); - - String line; - while ((line = reader.readLine()) != null) { - if (!line.trim().equalsIgnoreCase("")) { - sb.append(line).append("\n"); - } - } - } finally { - is.close(); - } - - return sb.toString(); - } else { - return null; - } - } - - /** - * Create collection. - * - * @param generatedTestCaseList the generated test case list - * @param excelFilePath the excel file path - * @param generatedPath the generated path - * @throws IOException the io exception - */ - public static void createCollection(List generatedTestCaseList, - String excelFilePath, - String generatedPath) - throws IOException, UnableToProcessException { - createCollection(null, generatedTestCaseList, - excelFilePath, - generatedPath); - - } - - private static Map getHeader(Row nextRow) { - Map headers = new HashMap<>(); - int headerIndex = 0; - for (Cell cell : nextRow) { - headers.put(headerIndex++, getCellValue(cell)); - - } - return headers; - } - - private static Map getRow(Row nextRow, Map headers) { - Map dataMap = new HashMap<>(); - if(nextRow != null) { - int lastColumn = Math.max(nextRow.getLastCellNum(), 5); - if(lastColumn > 0) { - for (Cell cell : nextRow) { - String key = headers.get(cell.getColumnIndex()); - dataMap.put(key, getCellValue(cell)); - } - } - } - return dataMap; - } - - /** - * Create collection. - * - * @param basePath the base path - * @param generatedTestCaseList the generated test case list - * @param excelFilePath the excel file path - * @param generatedPath the generated path - * @throws IOException the io exception - */ - public static void createCollection(String basePath, List generatedTestCaseList, - String excelFilePath, - String generatedPath) - throws IOException, UnableToProcessException { + private ExcelToCollectionGenerator() { + } + + + public static String convertStreamToString(InputStream is) throws IOException { + if (is != null) { + StringBuilder sb = new StringBuilder(); + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); + + String line; + while ((line = reader.readLine()) != null) { + if (!line.trim().equalsIgnoreCase("")) { + sb.append(line).append("\n"); + } + } + } finally { + is.close(); + } + + return sb.toString(); + } else { + return null; + } + } + + /** + * Create collection. + * + * @param generatedTestCaseList the generated test case list + * @param excelFilePath the excel file path + * @param generatedPath the generated path + * @throws IOException the io exception + */ + public static void createCollection(List generatedTestCaseList, + String excelFilePath, + String generatedPath) + throws IOException, UnableToProcessException { + createCollection(null, generatedTestCaseList, + excelFilePath, + generatedPath); + + } + + private static Map getHeader(Row nextRow) { + Map headers = new HashMap<>(); + int headerIndex = 0; + for (Cell cell : nextRow) { + headers.put(headerIndex++, getCellValue(cell)); + + } + return headers; + } + + private static boolean isEmptyRow(Row row) { + boolean isEmptyRow = true; + for (int cellNum = row.getFirstCellNum(); cellNum < row.getLastCellNum(); cellNum++) { + Cell cell = row.getCell(cellNum); + if (cell != null && cell.getCellType() != CellType.BLANK && StringUtils + .isNotBlank(cell.toString())) { + isEmptyRow = false; + } + } + return isEmptyRow; + } + + private static Map getRow(Row nextRow, Map headers) { + Map dataMap = new HashMap<>(); + if (nextRow != null && !isEmptyRow(nextRow)) { + for (Cell cell : nextRow) { + String key = headers.get(cell.getColumnIndex()); + dataMap.put(key, getCellValue(cell)); + } + } + return dataMap; + } + + /** + * Create collection. + * + * @param basePath the base path + * @param generatedTestCaseList the generated test case list + * @param excelFilePath the excel file path + * @param generatedPath the generated path + * @throws IOException the io exception + */ + public static void createCollection(String basePath, List generatedTestCaseList, + String excelFilePath, + String generatedPath) + throws IOException, UnableToProcessException { + try { + BuildCollections buildCollections = new BuildCollections(basePath, generatedTestCaseList, + generatedPath, excelFilePath).createCollection(); + Map excludeResponseMap = buildCollections.getExcludeResponseMap(); + Map cucumblanMap = buildCollections.getCucumblanMap(); + createPrpos(generatedPath, cucumblanMap, "cucumblan.properties"); + InputStream streamEnv = Thread.currentThread().getContextClassLoader() + .getResourceAsStream("cucumblan-env.properties"); + if (streamEnv != null) { + createPrpos(generatedPath, streamEnv, "cucumblan-env.properties"); + } + if (!excludeResponseMap.isEmpty()) { + createPrpos(generatedPath, excludeResponseMap, "exclude-response.properties"); + } + } catch (Exception e) { + log.error( + "Unable to create collection for the given excel file " + excelFilePath + " >>> " + e + .getMessage()); + } + + } + + private static void getAsSingleFile(int sheet, List generatedTestCaseList, + String generatedPath, + Map cucumblanMap, JSONArray virtualanArray) { + Map arrayMap = buildByMiniCategory(virtualanArray); + for (Map.Entry entry : arrayMap.entrySet()) { + JSONArray virtualanSingle = entry.getValue(); + String scenarioId = virtualanSingle.getJSONObject(0).getString("scenarioId").split("-")[0]; + if (byEachTestCase(generatedTestCaseList, scenarioId)) { + CreateFileInfo createFileInfo = new CreateFileInfo(); + createFileInfo.setGeneratedPath(generatedPath); + createFileInfo.setCucumblanMap(cucumblanMap); + createFileInfo.setVirtualanArray(virtualanSingle); + createFileInfo + .setTestcaseName( + "Virtualan_" + sheet + "_" + scenarioId); + createFileInfo.setScenario(scenarioId); + createIdaithalamProcessingFile(createFileInfo); + } + } + } + + private static Map buildByMiniCategory(JSONArray virtualanArray) { + Map arrayMap = new HashMap<>(); + for (int i = 0; i < virtualanArray.length(); i++) { + String scenarioId = virtualanArray.getJSONObject(i).getString("scenarioId").split("-")[0]; + JSONArray array = null; + if (arrayMap.containsKey(scenarioId)) { + array = arrayMap.get(scenarioId); + } else { + array = new JSONArray(); + } + array.put(virtualanArray.getJSONObject(i)); + arrayMap.put(scenarioId, array); + } + return arrayMap; + } + + private static JSONArray getObjectSheet(int sheet, List generatedTestCaseList, + SheetObject sheetObject) { + Map headers = new HashMap<>(); + JSONArray virtualanArray = new JSONArray(); + for (int i = 0; i <= sheetObject.getFirstSheet().getLastRowNum(); i++) { + Row nextRow = sheetObject.getFirstSheet().getRow(i); + if (headers.isEmpty()) { + headers = getHeader(nextRow); + } else { + String testcaseName = null; try { - BuildCollections buildCollections = new BuildCollections(basePath, generatedTestCaseList, - generatedPath, excelFilePath).createCollection(); - Map excludeResponseMap = buildCollections.getExcludeResponseMap(); - Map cucumblanMap = buildCollections.getCucumblanMap(); - createPrpos(generatedPath, cucumblanMap, "cucumblan.properties"); - InputStream streamEnv = Thread.currentThread().getContextClassLoader() - .getResourceAsStream("cucumblan-env.properties"); - if (streamEnv != null) { - createPrpos(generatedPath, streamEnv, "cucumblan-env.properties"); - } - if (!excludeResponseMap.isEmpty()) { - createPrpos(generatedPath, excludeResponseMap, "exclude-response.properties"); + Map finalRow = getRow(nextRow, headers); + testcaseName = finalRow.get("TestCaseName"); + if (!finalRow.isEmpty() && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || + generatedTestCaseList.stream().anyMatch(x -> finalRow.get("TestCaseName").contains(x)))) { + if (finalRow.get("Type") == null || "REST".equalsIgnoreCase(finalRow.get("Type"))) { + JSONObject object = buildRESTVirtualanCollection(sheetObject.getBasePath(),finalRow); + populateConfigMaps(finalRow, sheetObject.getCucumblanMap(), + sheetObject.getExcludeResponseMap()); + virtualanArray.put(object); } + } } catch (Exception e) { - log.error( - "Unable to create collection for the given excel file " + excelFilePath + " >>> " + e - .getMessage()); - } - - } - - private static void getAsSingleFile(int sheet, List generatedTestCaseList, - String generatedPath, - Map cucumblanMap, JSONArray virtualanArray) { - Map arrayMap = buildByMiniCategory(virtualanArray); - for (Map.Entry entry : arrayMap.entrySet()) { - JSONArray virtualanSingle = entry.getValue(); - String scenarioId = virtualanSingle.getJSONObject(0).getString("scenarioId").split("-")[0]; - if (byEachTestCase(generatedTestCaseList, scenarioId)) { - CreateFileInfo createFileInfo = new CreateFileInfo(); - createFileInfo.setGeneratedPath(generatedPath); - createFileInfo.setCucumblanMap(cucumblanMap); - createFileInfo.setVirtualanArray(virtualanSingle); - createFileInfo - .setTestcaseName( - "Virtualan_" + sheet + "_" + scenarioId); - createFileInfo.setScenario(scenarioId); - createIdaithalamProcessingFile(createFileInfo); - } - } - } - - private static Map buildByMiniCategory(JSONArray virtualanArray) { - Map arrayMap = new HashMap<>(); - for (int i = 0; i < virtualanArray.length(); i++) { - String scenarioId = virtualanArray.getJSONObject(i).getString("scenarioId").split("-")[0]; - JSONArray array = null; - if (arrayMap.containsKey(scenarioId)) { - array = arrayMap.get(scenarioId); - } else { - array = new JSONArray(); - } - array.put(virtualanArray.getJSONObject(i)); - arrayMap.put(scenarioId, array); - } - return arrayMap; - } - - private static JSONArray getObjectSheet(List generatedTestCaseList, - SheetObject sheetObject) - throws MalformedURLException { - Map headers = new HashMap<>(); - JSONArray virtualanArray = new JSONArray(); - for (int i = 0; i <= sheetObject.getFirstSheet().getLastRowNum() ; i++) { - Row nextRow = sheetObject.getFirstSheet().getRow(i); - if (headers.isEmpty()) { - headers = getHeader(nextRow); - } else { - Map finalRow = getRow(nextRow, headers); - if (finalRow != null && !finalRow.isEmpty() && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() || - generatedTestCaseList.stream().anyMatch(x -> finalRow.get("TestCaseName").contains(x)))) { - if (finalRow.get("Type") == null || "REST".equalsIgnoreCase(finalRow.get("Type"))) { - JSONObject object = buildRESTVirtualanCollection(sheetObject.getBasePath(), - finalRow); - populateConfigMaps(finalRow, sheetObject.getCucumblanMap(), - sheetObject.getExcludeResponseMap()); - virtualanArray.put(object); - } - } - } - } - return virtualanArray; - } - - - private static boolean byEachTestCase(List generatedTestCaseList, - String scenarioId) { - return (!IdaithalamConfiguration.isWorkFlow() - && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() - || generatedTestCaseList.stream().anyMatch(x -> scenarioId.contains(x)))); - - } - - /** - * Gets input stream. - * - * @param basePath the base path - * @param fileNameWithSubCategory the file name with sub category - * @return the input stream - * @throws FileNotFoundException the file not found exception - */ - public static InputStream getInputStream(String basePath, String fileNameWithSubCategory) - throws FileNotFoundException, UnableToProcessException { - InputStream stream = null; - String filePath = basePath + File.separator + fileNameWithSubCategory; - File file = new File(filePath); - File fileSub = new File(fileNameWithSubCategory); - if (file.exists()) { - stream = new FileInputStream(file); - } else if (fileSub.exists()) { - stream = new FileInputStream(fileSub); - } - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - if (stream == null) { - log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); - throw new UnableToProcessException( - " File is missing(" + basePath + ") : " + fileNameWithSubCategory); - } - return stream; - } - - /** - * Gets file as string. - * - * @param basePath the base path - * @param fileNameWithSubCategory the file name with sub category - * @return the file as string - * @throws IOException the io exception - */ - public static String getFileAsString(String basePath, String fileNameWithSubCategory) - throws IOException { - InputStream stream = null; - String filePath = basePath + File.separator + fileNameWithSubCategory; - File file = new File(filePath); - File fileSub = new File(fileNameWithSubCategory); - if (file.exists()) { - stream = new FileInputStream(file); - } else if (fileSub.exists()) { - stream = new FileInputStream(fileSub); - } - stream = getInputStream(fileNameWithSubCategory, stream, filePath); - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = ExcelToCollectionGenerator.class.getClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - if (stream == null) { - log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); - System.exit(-1); - } - return convertStreamToString(stream); - } - - private static InputStream getInputStream(String fileNameWithSubCategory, - InputStream stream, - String filePath) { - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); - if (stream == null) { - stream = Thread.currentThread().getContextClassLoader() - .getResourceAsStream(fileNameWithSubCategory); - } - } - return stream; - } - - private static Map getCucumblan() { - Map cucumblanMap = new HashMap<>(); - cucumblanMap.put("virtualan.data.load", ""); - cucumblanMap.put("virtualan.data.heading", ""); - cucumblanMap.put("virtualan.data.type", "VIRTUALAN"); - return cucumblanMap; - } - - private static JSONObject buildRESTVirtualanCollection(String basePath, - Map dataMap) throws MalformedURLException { - JSONObject virtualanObj = new JSONObject(); - JSONArray paramsArray = new JSONArray(); - getMultiRunValue(dataMap, virtualanObj, paramsArray); - virtualanObj.put("contentType", dataMap.get("ContentType")); - buildParam("contentType", dataMap.get("ContentType"), paramsArray, "HEADER_PARAM"); - createProcessingType(dataMap, paramsArray, "FormParams", "FORM_PARAM"); - createProcessingType(dataMap, paramsArray, "RequestHeaders", "HEADER_PARAM"); - createProcessingType(dataMap, paramsArray, "ResponseProcessingType", "HEADER_PARAM"); - virtualanObj.put("scenarioId", dataMap.get("TestCaseName")); - virtualanObj.put("scenario", dataMap.get("TestCaseNameDesc")); - createProcessingType(dataMap, paramsArray, "StoreResponseVariables", "STORAGE_PARAM"); - createProcessingType(dataMap, paramsArray, "AddifyVariables", "ADDIFY_PARAM"); - createProcessingType(dataMap, paramsArray, "CookieVariables", "COOKIE_PARAM"); - getValue("Tags", dataMap, virtualanObj); - getValue("SkipScenario", dataMap, virtualanObj); - getSecurityValue(dataMap, virtualanObj); - if (dataMap.get("Action") != null) { - virtualanObj.put("method", - dataMap.get("Action").toUpperCase()); - } else { - log.error("HTTP ACTION IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); - } - if (dataMap.get("URL") != null) { - URL aURL = new URL(dataMap.get("URL")); - String resource = getResource(aURL.getPath()); - virtualanObj.put("url", aURL.getPath()); - virtualanObj.put("resource", resource); - createQueryParam(aURL.getQuery(), paramsArray); - } else { - log.error("URL IS MANDATORY!!! for " + dataMap.get("TestCaseName")); - } - if (dataMap.get("RequestFile") != null || dataMap.get("RequestContent") != null) { - virtualanObj.put("input", buildObjectRequest(basePath, dataMap)); - } - if (dataMap.get("ResponseByFields") != null) { - virtualanObj.put("outputFields", dataMap.get("ResponseByFields")); - }else if (dataMap.get("Csvson") != null) { - virtualanObj.put("csvson", dataMap.get("Csvson")); - }else if (dataMap.get("ResponseFile") != null || dataMap.get("ResponseContent") != null) { - if (dataMap.get("IncludesByPath") != null) { - virtualanObj.put("outputPaths", dataMap.get("IncludesByPath")); - } - virtualanObj.put("output", buildObjectResponse(basePath, dataMap)); - } - builHttpStausCode(dataMap, virtualanObj); - if (paramsArray.length() > 0) { - virtualanObj.put("availableParams", paramsArray); - } - return virtualanObj; - } - - private static void getSecurityValue(Map dataMap, JSONObject virtualanObj) { - String security = dataMap.get("Security"); - if (security != null && !security.isEmpty() && security.split("=").length == 2) { - virtualanObj.put("security", "okta"); - } else if (dataMap.get("Security") != null) { - virtualanObj.put("security", security); - } - - } - - private static void getValue(String key, Map dataMap, JSONObject virtualanObj) { - if (dataMap.get(key) != null) { - virtualanObj.put(key, dataMap.get(key)); - } - } - - private static void getMultiRunValue(Map dataMap, JSONObject virtualanObj, - JSONArray paramsArray) { - if (dataMap.get("MultiRun") != null) { - virtualanObj.put("MultiRun", dataMap.get("MultiRun")); - String row = dataMap.get("MultiRun").split(";")[0]; - for (String param : row.split("\\|")) { - buildParam(param, "<" + param + ">", paramsArray, "ADDIFY_PARAM"); - } - } - } - - - private static void builHttpStausCode(Map dataMap, JSONObject virtualanObj) { - if (dataMap.get("StatusCode") != null) { - virtualanObj.put("httpStatusCode", dataMap.get("StatusCode")); - } else { - log.error("HTTP STATUS CODE IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); - } - } - - private static String buildObjectResponse(String basePath, Map responseFile) { - try { - String body = null; - if (responseFile.get("ResponseContent") != null) { - body = responseFile.get("ResponseContent"); - } else if (responseFile.get("ResponseFile") != null) { - body = getFileAsString(basePath, responseFile.get("ResponseFile")); - } - if (body != null) { - return body.trim(); - } else { - log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " - + responseFile.get("ResponseContent")); - } - } catch (IOException e) { - log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " - + responseFile.get("ResponseContent")); - } - return null; - } - - private static String buildObjectRequest(String basePath, Map requestFile) { - try { - String body = null; - if (requestFile.get("RequestContent") != null) { - body = requestFile.get("RequestContent"); - } else if (requestFile.get("RequestFile") != null) { - body = getFileAsString(basePath, requestFile.get("RequestFile")); - } - if (body != null) { - return body.trim(); - } else { - log.warn("Unable to load " + requestFile + " file or content > " + requestFile); - } - } catch (IOException e) { - log.warn("Unable to load " + requestFile + " file or conten> " + requestFile); - } - return null; - } - - private static void createProcessingType(Map dataMap, - JSONArray paramsArray, String requestProcessingType, String param) { - if (dataMap.get(requestProcessingType) != null) { - String[] processTypes = dataMap.get(requestProcessingType).split(";"); - for (String keyValue : processTypes) { - String[] processType = keyValue.split("="); - if (processType.length == 2) { - buildParam(processType[0], processType[1], paramsArray, param); - } - } - } - } - - private static void createIdaithalamProcessingFile( - CreateFileInfo createFileInfo) { - String fileCreated = generateExcelJson(createFileInfo.getGeneratedPath(), - createFileInfo.getVirtualanArray(), - createFileInfo.getTestcaseName()); - if (fileCreated != null) { - String filesCreated = createFileInfo.getCucumblanMap().get("virtualan.data.load"); - createFileInfo.getCucumblanMap().put("virtualan.data.load", filesCreated + fileCreated + ";"); - String headings = createFileInfo.getCucumblanMap().get("virtualan.data.heading"); - createFileInfo.getCucumblanMap() - .put("virtualan.data.heading", headings + createFileInfo.getScenario() + ";"); - } - } - - private static String getResource(String resource) { - if (resource.split("/").length > 0) { - return resource.split("/")[1]; - } - return "default"; - } - - private static void createPrpos(String path, InputStream stream, String fileName) { - try { - Properties props = new Properties(); - //Populating the properties file - props.load(stream); - //Instantiating the FileInputStream for output file - FileOutputStream outputStrem = new FileOutputStream( - path + File.separator + fileName); - //Storing the properties file - props.store(outputStrem, "This is a " + fileName + " properties file"); - log.info(fileName + " Properties file created......"); - } catch (IOException e) { - log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); - } - } - - public static void createPrpos(String path, Map propsMap, String fileName) { - try { - Properties props = new Properties(); - //Populating the properties file - props.putAll(propsMap); - //Instantiating the FileInputStream for output file - FileOutputStream outputStrem = new FileOutputStream( - path + File.separator + fileName); - //Storing the properties file - props.store(outputStrem, "This is a " + fileName + " properties file"); - log.info(fileName + " Properties file created......"); - } catch (IOException e) { - log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); - } - } - - private static String generateExcelJson(String path, JSONArray excelArray, String fileName) { - String fileCreated = null; - try { - FileOutputStream outputStream = new FileOutputStream( - path + File.separator + fileName + ".json"); - Writer writer = new OutputStreamWriter(outputStream); - CharSequence cs = excelArray.toString(); - writer.append(cs); - writer.close(); - fileCreated = fileName + ".json"; - } catch (IOException e) { - log.warn(" Unable to generate Virtualan JSON " + fileName + " : " + e.getMessage()); - } - return fileCreated; - } - - private static void buildParam(String key, String value, JSONArray paramsArray, String param) { - JSONObject virtualanObjParam = new JSONObject(); - virtualanObjParam.put("key", key); - virtualanObjParam.put("value", value); - virtualanObjParam.put("parameterType", param); - paramsArray.put(virtualanObjParam); - } - - private static void createQueryParam(String queryString, JSONArray paramsArray) { - if (queryString != null) { - String[] querys = queryString.split("&"); - for (String query : querys) { - JSONObject virtualanObjParam = new JSONObject(); - String[] queryPart = query.split("="); - virtualanObjParam.put("key", queryPart[0]); - if (queryPart.length == 2) { - virtualanObjParam.put("value", queryPart[1]); - } else { - virtualanObjParam.put("value", ""); - } - virtualanObjParam.put("parameterType", "QUERY_PARAM"); - paramsArray.put(virtualanObjParam); - } - } - } - - private static void populateConfigMaps( - Map dataMap, Map cucumblanMap, - Map excludeResponseMap) throws MalformedURLException { + log.warn("Spread sheet (" + testcaseName + ") " + (sheet+1) + " with row number " + (i+1) + + " is unable to process for the reason >> " + + e.getMessage()); + } + } + } + return virtualanArray; + } + + + private static boolean byEachTestCase(List generatedTestCaseList, + String scenarioId) { + return (!IdaithalamConfiguration.isWorkFlow() + && (generatedTestCaseList == null || generatedTestCaseList.isEmpty() + || generatedTestCaseList.stream().anyMatch(x -> scenarioId.contains(x)))); + + } + + /** + * Gets input stream. + * + * @param basePath the base path + * @param fileNameWithSubCategory the file name with sub category + * @return the input stream + * @throws FileNotFoundException the file not found exception + */ + public static InputStream getInputStream(String basePath, String fileNameWithSubCategory) + throws FileNotFoundException, UnableToProcessException { + InputStream stream = null; + String filePath = basePath + File.separator + fileNameWithSubCategory; + File file = new File(filePath); + File fileSub = new File(fileNameWithSubCategory); + if (file.exists()) { + stream = new FileInputStream(file); + } else if (fileSub.exists()) { + stream = new FileInputStream(fileSub); + } + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + if (stream == null) { + log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); + throw new UnableToProcessException( + " File is missing(" + basePath + ") : " + fileNameWithSubCategory); + } + return stream; + } + + /** + * Gets file as string. + * + * @param basePath the base path + * @param fileNameWithSubCategory the file name with sub category + * @return the file as string + * @throws IOException the io exception + */ + public static String getFileAsString(String basePath, String fileNameWithSubCategory) + throws IOException { + InputStream stream = null; + String filePath = basePath + File.separator + fileNameWithSubCategory; + File file = new File(filePath); + File fileSub = new File(fileNameWithSubCategory); + if (file.exists()) { + stream = new FileInputStream(file); + } else if (fileSub.exists()) { + stream = new FileInputStream(fileSub); + } + stream = getInputStream(fileNameWithSubCategory, stream, filePath); + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = ExcelToCollectionGenerator.class.getClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + if (stream == null) { + log.error(" File is missing(" + basePath + ") : " + fileNameWithSubCategory); + System.exit(-1); + } + return convertStreamToString(stream); + } + + private static InputStream getInputStream(String fileNameWithSubCategory, + InputStream stream, + String filePath) { + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); + if (stream == null) { + stream = Thread.currentThread().getContextClassLoader() + .getResourceAsStream(fileNameWithSubCategory); + } + } + return stream; + } + + private static Map getCucumblan() { + Map cucumblanMap = new HashMap<>(); + cucumblanMap.put("virtualan.data.load", ""); + cucumblanMap.put("virtualan.data.heading", ""); + cucumblanMap.put("virtualan.data.type", "VIRTUALAN"); + return cucumblanMap; + } + + private static JSONObject buildRESTVirtualanCollection(String basePath, + Map dataMap) + throws UnableToProcessException { + JSONObject virtualanObj = new JSONObject(); + try { + JSONArray paramsArray = new JSONArray(); + getMultiRunValue(dataMap, virtualanObj, paramsArray); + virtualanObj.put("contentType", dataMap.get("ContentType")); + buildParam("contentType", dataMap.get("ContentType"), paramsArray, "HEADER_PARAM"); + createProcessingType(dataMap, paramsArray, "FormParams", "FORM_PARAM"); + createProcessingType(dataMap, paramsArray, "RequestHeaders", "HEADER_PARAM"); + createProcessingType(dataMap, paramsArray, "ResponseProcessingType", "HEADER_PARAM"); + virtualanObj.put("scenarioId", dataMap.get("TestCaseName")); + virtualanObj.put("scenario", dataMap.get("TestCaseNameDesc")); + createProcessingType(dataMap, paramsArray, "StoreResponseVariables", "STORAGE_PARAM"); + createProcessingType(dataMap, paramsArray, "AddifyVariables", "ADDIFY_PARAM"); + createProcessingType(dataMap, paramsArray, "CookieVariables", "COOKIE_PARAM"); + getValue("Tags", dataMap, virtualanObj); + getValue("SkipScenario", dataMap, virtualanObj); + getSecurityValue(dataMap, virtualanObj); + if (dataMap.get("Action") != null) { + virtualanObj.put("method", + dataMap.get("Action").toUpperCase()); + } else { + log.error("HTTP ACTION IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); + } + if (dataMap.get("URL") != null) { URL aURL = new URL(dataMap.get("URL")); String resource = getResource(aURL.getPath()); - cucumblanMap.put("service.api." + resource, - aURL.getProtocol() + "://" + aURL.getAuthority()); - String okta = dataMap.get("Security"); - if (okta != null && !okta.isEmpty() && okta.split("=").length == 2) { - cucumblanMap.put("service.api.okta_token." + resource, okta.split("=")[1]); - } - if (dataMap.get("ExcludeFields") != null) { - excludeResponseMap.put(aURL.getPath(), dataMap.get("ExcludeFields")); - } - } - - private static String getCellValue(Cell cell) { - if (cell.getCellTypeEnum() != CellType.FORMULA) { - switch (cell.getCellTypeEnum()) { - case STRING: - return cell.getStringCellValue().trim(); - case BOOLEAN: - return String.valueOf(cell.getBooleanCellValue()); - case NUMERIC: - return String.valueOf((int) cell.getNumericCellValue()); - default: - return null; - } - } - return null; - } - - private static class BuildCollections { - - private final String basePath; - private final List generatedTestCaseList; - private final String generatedPath; - private final String inputExcel; - private Map excludeResponseMap; - private Map cucumblanMap; - - BuildCollections(String basePath, List generatedTestCaseList, - String generatedPath, - String inputExcel) { - this.basePath = basePath; - this.generatedTestCaseList = generatedTestCaseList; - this.generatedPath = generatedPath; - this.inputExcel = inputExcel; - } - - Map getExcludeResponseMap() { - return excludeResponseMap; - } - - Map getCucumblanMap() { - return cucumblanMap; - } - - - BuildCollections createCollection() throws IOException, UnableToProcessException { - excludeResponseMap = new HashMap<>(); - cucumblanMap = getCucumblan(); - InputStream stream = getInputStream(basePath, inputExcel); - Workbook workbook = null; - try { - workbook = new XSSFWorkbook(stream); - for (int sheet = 0; sheet < workbook.getNumberOfSheets(); sheet++) { - Sheet firstSheet = workbook.getSheetAt(sheet); - SheetObject sheetObject = new SheetObject(); - sheetObject.setBasePath(basePath); - sheetObject.setExcludeResponseMap(excludeResponseMap); - sheetObject.setCucumblanMap(cucumblanMap); - sheetObject.setFirstSheet(firstSheet); - createCollections(generatedTestCaseList, sheet, firstSheet, sheetObject); - } - } catch (Exception e) { - log.error( - "Unable to create collection for the given excel file " + inputExcel + " <<< " + e.getMessage()); - } finally { - if (workbook != null) - workbook.close(); - if (stream != null) - stream.close(); - } - return this; + virtualanObj.put("url", aURL.getPath()); + virtualanObj.put("resource", resource); + createQueryParam(aURL.getQuery(), paramsArray); + } else { + log.error("URL IS MANDATORY!!! for " + dataMap.get("TestCaseName")); + } + if (dataMap.get("RequestFile") != null || dataMap.get("RequestContent") != null) { + virtualanObj.put("input", buildObjectRequest(basePath, dataMap)); + } + if (dataMap.get("ResponseByFields") != null) { + virtualanObj.put("outputFields", dataMap.get("ResponseByFields")); + } else if (dataMap.get("Csvson") != null) { + virtualanObj.put("csvson", dataMap.get("Csvson")); + } else if (dataMap.get("ResponseFile") != null || dataMap.get("ResponseContent") != null) { + if (dataMap.get("IncludesByPath") != null) { + virtualanObj.put("outputPaths", dataMap.get("IncludesByPath")); + } + virtualanObj.put("output", buildObjectResponse(basePath, dataMap)); + } + builHttpStausCode(dataMap, virtualanObj); + if (paramsArray.length() > 0) { + virtualanObj.put("availableParams", paramsArray); + } + } catch (Exception e) { + throw new UnableToProcessException( + "Unable to build collection object for " + dataMap.get("TestCaseName") + " :: " + e + .getMessage()); + } + return virtualanObj; + } + + private static void getSecurityValue(Map dataMap, JSONObject virtualanObj) { + String security = dataMap.get("Security"); + if (security != null && !security.isEmpty() && security.split("=").length == 2) { + virtualanObj.put("security", "okta"); + } else if (dataMap.get("Security") != null) { + virtualanObj.put("security", security); + } + + } + + private static void getValue(String key, Map dataMap, JSONObject virtualanObj) { + if (dataMap.get(key) != null) { + virtualanObj.put(key, dataMap.get(key)); + } + } + + private static void getMultiRunValue(Map dataMap, JSONObject virtualanObj, + JSONArray paramsArray) { + if (dataMap.get("MultiRun") != null) { + virtualanObj.put("MultiRun", dataMap.get("MultiRun")); + String row = dataMap.get("MultiRun").split(";")[0]; + for (String param : row.split("\\|")) { + buildParam(param, "<" + param + ">", paramsArray, "ADDIFY_PARAM"); + } + } + } + + + private static void builHttpStausCode(Map dataMap, JSONObject virtualanObj) { + if (dataMap.get("StatusCode") != null) { + virtualanObj.put("httpStatusCode", dataMap.get("StatusCode")); + } else { + log.error("HTTP STATUS CODE IS MANDATORY!!! " + dataMap.get("TestCaseNameDesc")); + } + } + + private static String buildObjectResponse(String basePath, Map responseFile) { + try { + String body = null; + if (responseFile.get("ResponseContent") != null) { + body = responseFile.get("ResponseContent"); + } else if (responseFile.get("ResponseFile") != null) { + body = getFileAsString(basePath, responseFile.get("ResponseFile")); + } + if (body != null) { + return body.trim(); + } else { + log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + + responseFile.get("ResponseContent")); + } + } catch (IOException e) { + log.warn("Unable to load " + responseFile.get("ResponseFile") + " file or content > " + + responseFile.get("ResponseContent")); + } + return null; + } + + private static String buildObjectRequest(String basePath, Map requestFile) { + try { + String body = null; + if (requestFile.get("RequestContent") != null) { + body = requestFile.get("RequestContent"); + } else if (requestFile.get("RequestFile") != null) { + body = getFileAsString(basePath, requestFile.get("RequestFile")); + } + if (body != null) { + return body.trim(); + } else { + log.warn("Unable to load " + requestFile + " file or content > " + requestFile); + } + } catch (IOException e) { + log.warn("Unable to load " + requestFile + " file or conten> " + requestFile); + } + return null; + } + + private static void createProcessingType(Map dataMap, + JSONArray paramsArray, String requestProcessingType, String param) { + if (dataMap.get(requestProcessingType) != null) { + String[] processTypes = dataMap.get(requestProcessingType).split(";"); + for (String keyValue : processTypes) { + String[] processType = keyValue.split("="); + if (processType.length == 2) { + buildParam(processType[0], processType[1], paramsArray, param); + } + } + } + } + + private static void createIdaithalamProcessingFile( + CreateFileInfo createFileInfo) { + String fileCreated = generateExcelJson(createFileInfo.getGeneratedPath(), + createFileInfo.getVirtualanArray(), + createFileInfo.getTestcaseName()); + if (fileCreated != null) { + String filesCreated = createFileInfo.getCucumblanMap().get("virtualan.data.load"); + createFileInfo.getCucumblanMap().put("virtualan.data.load", filesCreated + fileCreated + ";"); + String headings = createFileInfo.getCucumblanMap().get("virtualan.data.heading"); + createFileInfo.getCucumblanMap() + .put("virtualan.data.heading", headings + createFileInfo.getScenario() + ";"); + } + } + + private static String getResource(String resource) { + if (resource.split("/").length > 0) { + return resource.split("/")[1]; + } + return "default"; + } + + private static void createPrpos(String path, InputStream stream, String fileName) { + try { + Properties props = new Properties(); + //Populating the properties file + props.load(stream); + //Instantiating the FileInputStream for output file + FileOutputStream outputStrem = new FileOutputStream( + path + File.separator + fileName); + //Storing the properties file + props.store(outputStrem, "This is a " + fileName + " properties file"); + log.info(fileName + " Properties file created......"); + } catch (IOException e) { + log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); + } + } + + public static void createPrpos(String path, Map propsMap, String fileName) { + try { + Properties props = new Properties(); + //Populating the properties file + props.putAll(propsMap); + //Instantiating the FileInputStream for output file + FileOutputStream outputStrem = new FileOutputStream( + path + File.separator + fileName); + //Storing the properties file + props.store(outputStrem, "This is a " + fileName + " properties file"); + log.info(fileName + " Properties file created......"); + } catch (IOException e) { + log.warn(" Unable to generate " + fileName + " properties " + e.getMessage()); + } + } + + private static String generateExcelJson(String path, JSONArray excelArray, String fileName) { + String fileCreated = null; + try { + FileOutputStream outputStream = new FileOutputStream( + path + File.separator + fileName + ".json"); + Writer writer = new OutputStreamWriter(outputStream); + CharSequence cs = excelArray.toString(); + writer.append(cs); + writer.close(); + fileCreated = fileName + ".json"; + } catch (IOException e) { + log.warn(" Unable to generate Virtualan JSON " + fileName + " : " + e.getMessage()); + } + return fileCreated; + } + + private static void buildParam(String key, String value, JSONArray paramsArray, String param) { + JSONObject virtualanObjParam = new JSONObject(); + virtualanObjParam.put("key", key); + virtualanObjParam.put("value", value); + virtualanObjParam.put("parameterType", param); + paramsArray.put(virtualanObjParam); + } + + private static void createQueryParam(String queryString, JSONArray paramsArray) { + if (queryString != null) { + String[] querys = queryString.split("&"); + for (String query : querys) { + JSONObject virtualanObjParam = new JSONObject(); + String[] queryPart = query.split("="); + virtualanObjParam.put("key", queryPart[0]); + if (queryPart.length == 2) { + virtualanObjParam.put("value", queryPart[1]); + } else { + virtualanObjParam.put("value", ""); } - - private void createCollections(List generatedTestCaseList, int sheet, Sheet firstSheet, - SheetObject sheetObject) - throws MalformedURLException { - JSONArray virtualanArray = getObjectSheet(generatedTestCaseList, sheetObject); - log.info(virtualanArray.toString()); - if (virtualanArray.length() > 0) { - if (IdaithalamConfiguration.isWorkFlow()) { - CreateFileInfo createFileInfo = new CreateFileInfo(); - createFileInfo.setGeneratedPath(generatedPath); - createFileInfo.setCucumblanMap(cucumblanMap); - createFileInfo.setVirtualanArray(virtualanArray); - createFileInfo.setTestcaseName( - "Virtualan_" + sheet + "_" + firstSheet.getSheetName().replaceAll(" ", "_") - + "_WORKFLOW_" + sheet); - createFileInfo.setScenario("WORKFLOW:" + firstSheet.getSheetName()); - createIdaithalamProcessingFile(createFileInfo); - } else { - getAsSingleFile(sheet, generatedTestCaseList, generatedPath, cucumblanMap, - virtualanArray); - } - } + virtualanObjParam.put("parameterType", "QUERY_PARAM"); + paramsArray.put(virtualanObjParam); + } + } + } + + private static void populateConfigMaps( + Map dataMap, Map cucumblanMap, + Map excludeResponseMap) throws MalformedURLException { + URL aURL = new URL(dataMap.get("URL")); + String resource = getResource(aURL.getPath()); + cucumblanMap.put("service.api." + resource, + aURL.getProtocol() + "://" + aURL.getAuthority()); + String okta = dataMap.get("Security"); + if (okta != null && !okta.isEmpty() && okta.split("=").length == 2) { + cucumblanMap.put("service.api.okta_token." + resource, okta.split("=")[1]); + } + if (dataMap.get("ExcludeFields") != null) { + excludeResponseMap.put(aURL.getPath(), dataMap.get("ExcludeFields")); + } + } + + private static String getCellValue(Cell cell) { + if (cell.getCellTypeEnum() != CellType.FORMULA) { + switch (cell.getCellTypeEnum()) { + case STRING: + return cell.getStringCellValue().trim(); + case BOOLEAN: + return String.valueOf(cell.getBooleanCellValue()); + case NUMERIC: + return String.valueOf((int) cell.getNumericCellValue()); + default: + return null; + } + } + return null; + } + + private static class BuildCollections { + + private final String basePath; + private final List generatedTestCaseList; + private final String generatedPath; + private final String inputExcel; + private Map excludeResponseMap; + private Map cucumblanMap; + + BuildCollections(String basePath, List generatedTestCaseList, + String generatedPath, + String inputExcel) { + this.basePath = basePath; + this.generatedTestCaseList = generatedTestCaseList; + this.generatedPath = generatedPath; + this.inputExcel = inputExcel; + } + + Map getExcludeResponseMap() { + return excludeResponseMap; + } + + Map getCucumblanMap() { + return cucumblanMap; + } + + + BuildCollections createCollection() throws IOException, UnableToProcessException { + excludeResponseMap = new HashMap<>(); + cucumblanMap = getCucumblan(); + InputStream stream = getInputStream(basePath, inputExcel); + Workbook workbook = null; + try { + workbook = new XSSFWorkbook(stream); + for (int sheet = 0; sheet < workbook.getNumberOfSheets(); sheet++) { + Sheet firstSheet = workbook.getSheetAt(sheet); + SheetObject sheetObject = new SheetObject(); + sheetObject.setBasePath(basePath); + sheetObject.setExcludeResponseMap(excludeResponseMap); + sheetObject.setCucumblanMap(cucumblanMap); + sheetObject.setFirstSheet(firstSheet); + createCollections(generatedTestCaseList, sheet, firstSheet, sheetObject); + } + } catch (Exception e) { + log.error( + "Unable to create collection for the given excel file " + inputExcel + " <<< " + e + .getMessage()); + } finally { + if (workbook != null) { + workbook.close(); + } + if (stream != null) { + stream.close(); + } + } + return this; + } + + private void createCollections(List generatedTestCaseList, int sheet, Sheet firstSheet, + SheetObject sheetObject) + throws MalformedURLException { + JSONArray virtualanArray = getObjectSheet(sheet, generatedTestCaseList, sheetObject); + log.info("Sheet no " + sheet + " build out" + virtualanArray.toString()); + if (virtualanArray.length() > 0) { + if (IdaithalamConfiguration.isWorkFlow()) { + CreateFileInfo createFileInfo = new CreateFileInfo(); + createFileInfo.setGeneratedPath(generatedPath); + createFileInfo.setCucumblanMap(cucumblanMap); + createFileInfo.setVirtualanArray(virtualanArray); + createFileInfo.setTestcaseName( + "Virtualan_" + sheet + "_" + firstSheet.getSheetName().replaceAll(" ", "_") + + "_WORKFLOW_" + sheet); + createFileInfo.setScenario("WORKFLOW:" + firstSheet.getSheetName()); + createIdaithalamProcessingFile(createFileInfo); + } else { + getAsSingleFile(sheet, generatedTestCaseList, generatedPath, cucumblanMap, + virtualanArray); } + } } + } } diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java index 0155e98d..e0215a94 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/FeatureGenerationHelper.java @@ -398,7 +398,9 @@ private static Object getJSON(String json) { try { return new JSONArray(json); } catch (Exception e) { - LOGGER.warning(json + " is invalid"); + if (json.contains("{") && json.contains("}")) { + log.warn( json +" is not a valid JSON!. Correct the JSON file!"); + } return json; } } From 65b75dbee9dd8ef792e81960d090fdf455f178d5 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Fri, 23 Apr 2021 20:50:18 -0500 Subject: [PATCH 28/29] Add useful information for the error message --- pom.xml | 1 + .../api-testing.xml | 4 ++-- samples/idaithalam-excel-apitesting/pom.xml | 2 +- ...ava => APITestWithExcelAsTestManager.java} | 2 +- .../virtualan_collection_testcase_8.xlsx | Bin 8181 -> 8172 bytes .../idaithalam-massapibatch-testing/pom.xml | 2 +- .../conf/feature/virtualan-contract.0.feature | 11 +++++++++-- .../conf/virtualan-provider.json | 2 +- samples/idaithalam-openapi-contract/pom.xml | 2 +- .../idaithalam-postmancoll-apitesting/pom.xml | 2 +- 10 files changed, 18 insertions(+), 10 deletions(-) rename samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/{APITestWithExcelAsRunManager.java => APITestWithExcelAsTestManager.java} (99%) diff --git a/pom.xml b/pom.xml index 7fb1bbe5..c547c480 100644 --- a/pom.xml +++ b/pom.xml @@ -75,6 +75,7 @@ samples/idaithalam-postmancoll-apitesting + samples/idaithalam-massapibatch-testing samples/idaithalam-excel-apitesting samples/idaithalam-openapi-contract diff --git a/samples/idaithalam-excel-apitesting/api-testing.xml b/samples/idaithalam-excel-apitesting/api-testing.xml index 498b31ee..a8a0015f 100644 --- a/samples/idaithalam-excel-apitesting/api-testing.xml +++ b/samples/idaithalam-excel-apitesting/api-testing.xml @@ -3,7 +3,7 @@ - + @@ -11,7 +11,7 @@ - + diff --git a/samples/idaithalam-excel-apitesting/pom.xml b/samples/idaithalam-excel-apitesting/pom.xml index 00f0d78e..6fa13944 100644 --- a/samples/idaithalam-excel-apitesting/pom.xml +++ b/samples/idaithalam-excel-apitesting/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.7 + 1.2.8-SNAPSHOT 7.4.0 1.8 ${java.version} diff --git a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsTestManager.java similarity index 99% rename from samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java rename to samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsTestManager.java index 999933e3..5776db0c 100644 --- a/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsRunManager.java +++ b/samples/idaithalam-excel-apitesting/src/test/java/io/virtualan/test/APITestWithExcelAsTestManager.java @@ -11,7 +11,7 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -public class APITestWithExcelAsRunManager { +public class APITestWithExcelAsTestManager { @BeforeClass public void testBeforeClass(){ diff --git a/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testcase_8.xlsx b/samples/idaithalam-excel-apitesting/src/test/resources/virtualan_collection_testcase_8.xlsx index c716b78cef8a829ee9a340f74c906ac090d274da..54ecec308c8426365f325029e1bca14703e48c35 100644 GIT binary patch delta 1032 zcmV+j1o!*(KkPrSZ5R&x`(Osj0{{RC4FCWb0F!?o6_bz{2Y+32>NXID@B1q}zUZ8D z5sW{8K*47UB!L`~Ig>eUuN7Mc53=P-GLV1Y^(VHZCYkmIg#7Hgt6gopnSZ+^#5iHb zW122ZdoVN&oCY+E)BVEy^2pczi#NkmzK1pH)si)Rd@uvAKj3f%b6S`=OJ}vlO%ex;avF)kW|p8}c1lPKUlgA$ zKLFmMQ4|LlyapD&1h@?Qwih=0Ow^Ukng)4-Q&F9rVSfTApeaAZ8E@1er=N>RN#@j= z_Tnn5^FOrO(t^_Hzv@!a2wv1n9%dW zgxg$iyu|y1C^r1L)zYwTCCbI0F+TIo+98y)Ul_9OV^pyrSf0h9 z!HVY~S}cACl9xQ>lEd!FAI_~)VOtZ+if}rF-6vM6hSMk3D&h8tJC*SI#Jx(4`^1Av zO!~w|B}P&pTMZ&b@~A;ZedN1}*izPZ8bnIllg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8 100644 --- a/samples/idaithalam-massapibatch-testing/pom.xml +++ b/samples/idaithalam-massapibatch-testing/pom.xml @@ -7,7 +7,7 @@ 1.0.1-SNAPSHOT 1.7.30 - 1.2.7 + 1.2.8-SNAPSHOT 1.8 7.4.0 ${java.version} diff --git a/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature b/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature index 850fa672..b2716c14 100644 --- a/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature +++ b/samples/idaithalam-openapi-contract/conf/feature/virtualan-contract.0.feature @@ -1,15 +1,22 @@ Feature: Sample.yaml - API Contract validation status Scenario: Load initial set of data Given Provided all the feature level parameters from file - @sample Scenario: Create a new sample object. - POST api call Given a user perform a api action + And Create api with given input + | filename | Sample.yaml | + | name | Sample | + | version | 0.0.1 | When a user post application/json in /sample resource on sample Then Verify the status code is 201 - @sample Scenario: Sample path - GET api call Given a user perform a api action And add request with given path params | sampleId | sampleId | When a user get application/json in /sample/validate/{sampleId} resource on sample Then Verify the status code is 200 + And Verify-all /sample/validate/{sampleId} api includes following in the response + | sample1 | one | + | id | i~1 | + | sample3 | three | + | sample2 | two | diff --git a/samples/idaithalam-openapi-contract/conf/virtualan-provider.json b/samples/idaithalam-openapi-contract/conf/virtualan-provider.json index c9f1ef61..425a51d3 100644 --- a/samples/idaithalam-openapi-contract/conf/virtualan-provider.json +++ b/samples/idaithalam-openapi-contract/conf/virtualan-provider.json @@ -1 +1 @@ -[{"input":"","method":"POST","scenario":"Create a new sample object.","resource":"sample","availableParams":[],"type":"Response","url":"/sample","httpStatusCode":"201"},{"output":"","method":"GET","scenario":"Sample path","resource":"sample","availableParams":[{"parameterType":"PATH_PARAM","value":"sampleId","key":"sampleId"}],"type":"Response","url":"/sample/validate/{sampleId}","httpStatusCode":"200"}] \ No newline at end of file +[{"input":"{\r\n \"filename\" : \"Sample.yaml\",\r\n \"name\" : \"Sample\",\r\n \"version\" : \"0.0.1\"\r\n}","method":"POST","scenario":"Create a new sample object.","resource":"sample","availableParams":[],"type":"Response","url":"/sample","httpStatusCode":"201"},{"output":"{\r\n \"sample1\" : \"one\",\r\n \"id\" : 1,\r\n \"sample3\" : \"three\",\r\n \"sample2\" : \"two\"\r\n}","method":"GET","scenario":"Sample path","resource":"sample","availableParams":[{"parameterType":"PATH_PARAM","value":"sampleId","key":"sampleId"}],"type":"Response","url":"/sample/validate/{sampleId}","httpStatusCode":"200"}] \ No newline at end of file diff --git a/samples/idaithalam-openapi-contract/pom.xml b/samples/idaithalam-openapi-contract/pom.xml index 33ce62cb..2b890ca4 100644 --- a/samples/idaithalam-openapi-contract/pom.xml +++ b/samples/idaithalam-openapi-contract/pom.xml @@ -8,7 +8,7 @@ idaithalam-opeapi-contract 1.0.0-SNAPSHOT - 1.1.5 + 1.1.0 1.8 ${java.version} ${java.version} diff --git a/samples/idaithalam-postmancoll-apitesting/pom.xml b/samples/idaithalam-postmancoll-apitesting/pom.xml index 9b0dc368..aaefd00f 100644 --- a/samples/idaithalam-postmancoll-apitesting/pom.xml +++ b/samples/idaithalam-postmancoll-apitesting/pom.xml @@ -6,7 +6,7 @@ idaithalam-postmancoll-apitesting 1.0.1-SNAPSHOT - 1.2.7 + 1.2.8-SNAPSHOT 1.8 ${java.version} ${java.version} From 9a47f5bb7c66da6dea3559d88314cdeb53b591c2 Mon Sep 17 00:00:00 2001 From: Elan Thangamani Date: Sat, 24 Apr 2021 17:21:33 -0500 Subject: [PATCH 29/29] Add useful information for the error message --- .../generator/ExcelToCollectionGenerator.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java index dca98690..56c40327 100644 --- a/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java +++ b/modules/idaithalam/src/main/java/io/virtualan/idaithalam/core/generator/ExcelToCollectionGenerator.java @@ -94,17 +94,22 @@ private static Map getHeader(Row nextRow) { } private static boolean isEmptyRow(Row row) { - boolean isEmptyRow = true; + if (row == null) { + return true; + } + if (row.getLastCellNum() <= 0) { + return true; + } for (int cellNum = row.getFirstCellNum(); cellNum < row.getLastCellNum(); cellNum++) { Cell cell = row.getCell(cellNum); - if (cell != null && cell.getCellType() != CellType.BLANK && StringUtils - .isNotBlank(cell.toString())) { - isEmptyRow = false; + if (cell != null && cell.getCellTypeEnum() != CellType.BLANK && StringUtils.isNotBlank(cell.toString())) { + return false; } } - return isEmptyRow; + return true; } + private static Map getRow(Row nextRow, Map headers) { Map dataMap = new HashMap<>(); if (nextRow != null && !isEmptyRow(nextRow)) {