{"id":24259092,"url":"https://github.com/arafkarsh/ms-test-quickstart","last_synced_at":"2025-09-23T20:31:16.836Z","repository":{"id":174364045,"uuid":"652126219","full_name":"arafkarsh/ms-test-quickstart","owner":"arafkarsh","description":"Microservice Test Automation Example for SpringBootTest 3.3.4, JUnit 5, TestNG 7, Spock 3, GitHub CoPilot, DiffBlue Cover, RestAssured 5, Cucumber 6, Selenium 4, Mockito 3, WireMock 3, Pact 4. All the testing frameworks are required to fully automate the testing for Microservices-based Apps.","archived":false,"fork":false,"pushed_at":"2025-01-01T07:25:15.000Z","size":6006,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-01T08:21:17.558Z","etag":null,"topics":["copilot","copilot-tutorial","cucumber","diffblue-cover","junit5","mockito","pact","selenium","spock","springboot3","springboot334","springboottest","testng-framework","wiremock"],"latest_commit_sha":null,"homepage":"http://www.arafkarsh.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arafkarsh.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-11T07:05:01.000Z","updated_at":"2025-01-01T07:25:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa5dbe2d-a47e-4dd8-bd20-7bff4f12c79b","html_url":"https://github.com/arafkarsh/ms-test-quickstart","commit_stats":null,"previous_names":["arafkarsh/ms-test-quickstart"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-test-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-test-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-test-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arafkarsh%2Fms-test-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arafkarsh","download_url":"https://codeload.github.com/arafkarsh/ms-test-quickstart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233996273,"owners_count":18763211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copilot","copilot-tutorial","cucumber","diffblue-cover","junit5","mockito","pact","selenium","spock","springboot3","springboot334","springboottest","testng-framework","wiremock"],"created_at":"2025-01-15T05:53:13.627Z","updated_at":"2025-09-23T20:31:16.097Z","avatar_url":"https://github.com/arafkarsh.png","language":"Java","readme":"# AI Driven - Test Generation for Microservices \n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-test-quickstart\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-test-quickstart)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-test-quickstart\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-test-quickstart)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-test-quickstart\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-test-quickstart)\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=arafkarsh_ms-test-quickstart\u0026metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=arafkarsh_ms-test-quickstart)\n\n- SpringBoot - 3.4.1\n- Spring Security - 6.4.2\n- Jakarta EE - 10\n- Java - 21+\n- Open API Swagger Docs - 2.7.0\n- Google Gson - 2.11.0\n\nThorough automation in application testing is crucial for guaranteeing the dependability and optimal \nperformance of cloud-native applications, particularly when prioritizing a rapid time-to-market \napproach through Continuous Deployment.\n\nThe approach includes unit testing, integration testing, contract testing, and end-to-end testing.\n\n- Unit testing: A unit test exercises the smallest piece of testable software in the application to determine whether it behaves as expected.\n- Component Testing: A component test limits the scope of the exercised software to a portion of the system under test, manipulating the system through internal code interfaces and using test doubles to isolate the code under test from other components.\n- Contract testing, facilitated by tools like Pact, ensures that services adhere to the agreed-upon API contracts.\n- Integration testing: An Integration Contract test is a test at the boundary of an external service verifying that it meets the contract expected by a consuming service.\n- End-to-end testing: An end-to-end test verifies that a system meets external requirements and achieves its goals, testing the entire system from end to end.\n\n![Microservices Testing Frameworks](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/Microservices-Testing-Tools.jpg)\n\n## Testing Categories for Microservices\n\n![Microservices Testing Categories](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/Microservices-Testing-Strategies-2.jpg)\n\n|     | Testing Category             | Tools                                      |\n|-----|------------------------------|--------------------------------------------|\n| 0   | Testing Platforms            | Junit, Spock, TestNG                       |\n| 1   | Unit Testing                 | Junit, Spock, TestNG                       |\n| 2   | Component Testing            | SpringBoot, Cucumber, RestAssured, Mockito |\n| 3   | Integration Contract Testing | SpringBoot, Mockito, WireMock, Pact        |\n| 4   | Integration Testing          | SpringBoot, WireMock                       |\n| 5   | UI Testing / E2E Testing     | Selenium + Cucumber                        |\n\n## To Run the SpringBoot Application\n\n### Setup the Env Variable for Decrypting the Password Key\n\nRun the follwing command line option\n```\n$ source encrypt your-db-password your-encrypton-key\n```\n![Passowrd-Gen](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/Password-Gen.jpg)\n\nYour encryption key will be set in the following Environment variable. SpringBoot Will automatically\npickup the encryption key from this environment variable.\n```\nJASYPT_ENCRYPTOR_PASSWORD=your-encrypton-key\n```\n\nUpdate the property file in the local file\n```\nspring.datasource.password=ENC(kkthRIyJ7ogLJP8PThfXjqko33snTUa9lY1GkyFpzr7KFRVhRVXLOMwNSIzr4EjFGAOWLhWTH5cAWzRzAfs33g==)\n```\nAND \nthe property template in src/main/resources/app.props.tmpl\n```\nspring.datasource.password=ENC(kkthRIyJ7ogLJP8PThfXjqko33snTUa9lY1GkyFpzr7KFRVhRVXLOMwNSIzr4EjFGAOWLhWTH5cAWzRzAfs33g==)\n```\nYou can use the following REST Endpoint to encrypt the sensitive data. This will work only after setting \nthe environment variable JASYPT_ENCRYPTOR_PASSWORD and creating the first DB password\nusing the command line options.\n![Passowrd-REST](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/ms-test-encrypt.jpg)\n\n### 1. Junit (5.10.2) - 134 Test Cases\n\n| 1   | Testing Framework | Version | Test Cases |\n|-----|-------------------|---------|------------|\n| 1.1 | JUnit 5           | 5.10.2  | 62         |\n| 1.2 | SpringBootTest 3  | 3.3.4   | 01         |\n| 1.3 | RestAssured 5     | 5.4.0   | 29         |\n| 1.4 | Mockito 5         | 5.12.0  | 21         |\n| 1.5 | WireMock 3        | 3.6.0   | 12         |\n| 1.6 | Cucumber 7        | 7.18.0  | 03         |\n| 1.7 | Selenium 4        | 4.12.0  | 02         |\n| 1.8 | Pact 4            | 4.0.10  | 03         |\n\n### 2. Spring Spock (2.4.0) - 45 Test Cases\n\n| 2   | Testing Framework | Version | Test Cases |\n|-----|-------------------|---------|------------|\n| 2.1 | Spock 2           | 2.4.0   | 21         |\n| 2.2 | SpringBootTest 3  |3.3.4   | 02         |\n| 2.3 | RestAssured 5     | 5.4.0   | 08         |\n| 2.4 | Mockito 5         | 5.12.0  | 02         |\n| 2.5 | WireMock 3        | 3.6.0   | 07         |\n| 2.6 | Cucumber 7        | 7.18.0  | 03         |\n| 2.7 | Selenium 4        | 4.12.0  | 02         |\n| 2.8 | Pact 4            | 4.0.10  | 00         |\n\n\n### 3. TestNG (7.10.2) - 35 Test Cases\n\n| 3   | Testing Framework | Version | Test Cases |\n|-----|-------------------|---------|------------|\n| 3.1 | TestNG 7          | 7.10.2  | 18         |\n| 3.2 | SpringBootTest 3  | 3.3.4   | 02         |\n| 3.3 | RestAssured 5     | 5.4.0   | 05         |\n| 3.4 | Mockito 5         | 5.12.0  | 02         |\n| 3.5 | WireMock 3        | 3.6.0   | 03         |\n| 3.6 | Cucumber 7        | 7.18.0  | 03         |\n| 3.7 | Selenium 4        | 4.12.0  | 02         |\n| 3.8 | Pact              | NA      | No Support |\n\n\n### 4. Assertions Libraries\n\n| 4   | Testing Framework | Version | \n|-----|-------------------|---------|\n| 4.1 | Hamcrest 2        | 2.2.0   | \n| 4.2 | Google Truth     | 1.0.1   |\n| 4.3 | AssertJ 3         | 3.26.3  | \n\n### 5. Other Utilities\n\n| 5   | Other Libraries | Version  |\n|-----|-----------------|----------|\n| 5.1 | Apache Commons  | 3.17.0   | \n| 5.2| Apache Http Client | 5.4.1    |\n| 5.3 | Apache Http Core | 5.3.1    |\n| 5.2 | Google GSON     | 2.8.7    |\n| 5.3 | Google Guava    | 33.3.1.1-jre |\n| 5.4 | Faster XML      | 2.18.0   |\n\n### 6. Logging Framework\n| 6 | Logging Libraries | Version  |\n|---|-------------------|----------|\n| 6.1 | SL4J              | 2.0.16 |\n| 6.2 | Logback           | 1.5.8| \n| 6.3 | Log stash         | 8.0 |\n\n### 7. Swagger Documentation\n| 7   | Open API Libraries | Version |\n|-----|--------------------|---------|\n| 7.1 | Open API Webmvc    | 2.6.0   |\n| 7.2 | Open API Common | 1.8.0   |\n\nOrder Microservice is part of an eCommerce Application. The objective of selecting this Microservice \nis to demonstrate various testing frameworks. As Order is a complex service with internal (Ex. Inventory, \nWarhouse, Shipping etc) and external (Payment) service integration and it has all the requirements \nto use various testing frameworks. The objective is to demonstrate various testing frameworks. \n\nOrder Service REST Endpoints are documented using Open API v3. \nYou can access the API's using http://localhost:9081/test-service/api/v1/swagger-ui.html\n\n![MS-Test-Quick-Start-1 based on Open API v3](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/ms-test-qs-order.jpg)\n\n![MS-Test-Quick-Start-2 based on Open API v3](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/ms-test-qs-core.jpg)\n\nOther Services\n\n1. Payment External Service\n2. Shipping Service\n3. Inventory Service\n4. Warehouse Service\n\nCurrently Order Service has a Mock Implementation of these services.\n\nNow let us focus on Microservices Testing Strategies.\n\n![Microservice Testing Strategies](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/Microservices-Testing-Strategies-1.jpg)\n\nThe following Test Categories helps you to automate the testing for Microservices based development \nresulting in ZERO End-2-End Testing.\n\nAll the tests will be fully automated as part of your CI/CD pipeline.\n\n## Dependencies\n\n- Spring Boot 3 (3.3.4)\n- Maven SureFire Plugin 2 (3.0.0-M7)\n\n## Testing Frameworks\n\n![Microservices Testing Frameworks](https://raw.githubusercontent.com/arafkarsh/ms-test-quickstart/master/diagrams/Microservices-Testing-Tools.jpg)\n\n\nCopyright (c) 2021-25, Apache 2.0 License, Author: Araf Karsh Hamid\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farafkarsh%2Fms-test-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farafkarsh%2Fms-test-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farafkarsh%2Fms-test-quickstart/lists"}