Provide an approach on how Consumers and Producer based APIs will be tested
POC on below core services to showcase all automation principles and guide
Localisation- Upsert and search call
FileStore- Search File
Property Tax- Create Property
Design & Implement Robust Automation Framework
Build a modular Framework so any future changes don’t have an impact on the entire framework but limited to a specific area
Implement a framework that is robust enough to function with minimal changes
Framework handles multi tenant with only properties update
Framework can switch environment with no manual update
A new environment can be integrated with update to framework properties
Global Properties:
Configuration The only rule is that on start-up Karate expects a file called karate-config.js to exist on the classpath and contain a JavaScript function. The function is expected to return a JSON object and all keys and values in that JSON object will be made available as script variables. And that's all there is to Karate configuration! You can easily get the value of the current 'environment' or 'profile', and then set up 'global' variables using some simple JavaScript.
Global Variables: Non-JSON values such as Java object references or JS functions are supported only if they are at the "root" of the JSON returned from karate-config.js.
Multiple Environment: Karate is flexible, you can easily overwrite config variables within each individual test-script - which is very convenient when in dev-mode or rapid-prototyping and also environment specific Config will be taken care of here. external config file having host name, credentials, stateCode, cityCode, etc.
Test Properties: Contains all properties related to Tests cases like Feature file, Http requests, responses, test data etc.
Framework Properties: Contains All properties related to Karate framework like pom.xml, YAML files, .md files etc.
Reports: We can generate default BDD cucumber reports and we can integrate reporting plugins.
Tests: Contains test scenarios feature files with execution tags, Assertions etc.
MDMS call: Fetching the test data from MDMS and using in tests.
Java
JavaScript
Gherkin
BDD framework - Behavior Driven Development is a software development approach
__All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
Executed test results and reports of all tests can be viewed in the target folder.
Pre-requisite: karate Runner plugin installation in VS code editor as specified in Readme.md
If not done during setup, then please install karate runner plugin as shown below.
Target folder generates test results folders as per time stamp of test suite runs.
When we run TestRunner file (ex: @regression), all the features under classpath would run and feature wise reports would be generated and placed under target/surefire-reports.
Post execution of test runs, the framework will automatically generate: surefire-reports
karate-summary.html
As we are using the JUnit runner for the execution of different scenarios that have been mentioned in the different *.feature files, it automatically creates a report for each of the feature files which are stored in the path target/surefire-reports.
cucumber-html-reports folder
Pretty Format generates the Cucumber test report in the HTML format, i.e. an HTML file. It is the most readable report format. It generates the report in the same way as it is a feature file, so tracing is also made easy. Also, you can specify the location where you want this report to be placed after the test execution.
A folder will automatically create under ./target/ folder along with timestamp which will contain cucumber-html-reports.
<To Integrate cucumber reporting, first we need to add cucumber maven dependency in pom.xml file and save. dependency> <groupId>net.masterthought</groupId> <artifactId>cucumber-reporting</artifactId> <version>3.8.0</version> </dependency>
Test Results target folder: eGov Test Automation Results are composed at cucumber-html-reports with timestamp of test execution reports.
Select the karate runner tab and click on overview-features.html to view the reports as shown in image.
Summary of service features and test status can be seen in details with Pass / Fail / run time stamp
****
Now, observe below Feature Report, you can see lots of verbose logging in the console and the actual output whether the features/scenarios are passed/ failed are skipped.
karate-summary.html:
__All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
All content on this page by is licensed under a .
Tag Name | BUSINESS SERVICES |
@apportionService | apportion-service |
@billingServiceDemand | billing-service/demand |
@collectionServices | Collection Services |
@dashboardAnalytics | Dashboard Analytics |
@egfMaster | EGF Master |
@egfInstrument | EGF Instrument |
@dashboardIngest | Dashboard Ingest |
@hrms | HRMS |
@billingServiceBill | Billing Service |
Tag Name | CORE SERVICES |
@accessControl | Access Control |
@egovWorkflowBusniessService | Egov Workflow Business Service |
@encService | Enc Service |
@fileStore | Filestore |
@idGenerate | Id Generate |
@localization | Localization Service |
@location | Location Service |
@mdmsService | MDMS |
@eGovUser | eGov User |
@eGovPdf | eGov PDF |
@pgservices | PG Service |
@reports | Reports |
@searcher | Searcher |
@url_Shorterning_Invalid | URL Shortening |
@userAccountAfterLock | User Account Lock |
@userOtp | User OTP |
@zuul | Zuul |
Tag Name | Municipal SERVICES |
@propertyServices | Property Tax |
@bpaCalculator | BPA Calculator |
@bpaService | BPA Service |
@dcrService | DCR Service |
@eGovUserEvent | eGov User Event |
@fireNOCBillingFeature | FireNOC Billing Slab |
@fireNocService | FireNOC |
@landService | Land Service |
@NOCService | NOC Service |
@PGRService | PGR Service |
@propertyCalculator | Property Tax Calculator |
@fsmService | FSM |
@fsmBillingSlab | FSM Calculator |
Tag Name | Service Type |
@coreServices | Core Services |
@businessServices | Business Services |
@municipalServices | Municipal Services |
@e2eServices | End To End Services |
Tag Name | Test Type |
@regression | Regression Tests |
Tag Name | E2E Service |
@propertyTaxEndToEnd | Property Tax and mCollect |
@tradeLicenseEndToEnd | Trade License |
@wsEndToEnd | Water and Sewerage Connection |
@fsmEndToEnd | FSM |
@pgrEndToEndFlow | PGR |
@firenocEndToEnd | FireNOC |
@bpae2eservice | BPA |