Giter Club home page Giter Club logo

javadiahad / microservice-test Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 615 KB

Sample application demonstrating testing a microservice in different layers according to test pyramid. CDC tests are used for testing interaction between ui application and rest service.

Java 57.87% JavaScript 12.85% TypeScript 26.02% HTML 2.20% CSS 0.20% Dockerfile 0.85%
spring-boot java angular test-pyramid testing jest continuous-testing consumer-driven-contract-testing cdc-test pact

microservice-test's Introduction

Simple Banking

accounts

accounts is a sample microservice application by spring boot, publishes accounts list and transfer endpoints accounts includes sample tests for different layers of an instance microservice.

  • Sociable Unit testing for Entities(They are not anemic)
  • Solitary Unit testing for Services
  • Integration test for Repositories
  • Component test for overall rest service test.
  • CDC test for API testing on the provider side.

cheques

cheques is a java sample client application for accounts service and includes a sample consumer test (CDC by Pact).

  • CDC test for integration testing(transfer service), consumer side.
  • workflow test(not finished)

bank-ui

bank-ui is a simple angular frontend application that consumes accounts backend service and includes unit and consumer tests (CDC by Pact).

  • Unit testing for Angular components(Jest).
  • CDC test for integration testing with backend(consumer side) by Pact.
  • E2E testing by Cypress(not finished)

pacts

pacts is a folder for sharing contracts between consumers(bank-ui,cheques) and provider(accounts) in CDC tests.

Test Tools

  • JUnit(jupiter)
  • Spring Framework Testing
  • Mokito
  • Hamcrest
  • RestAssured
  • Pact
  • Jest
  • Angular Testing

How to run tests for accounts

mvn clean package 

This command runs all tests including CDC tests. Or by running as JUnit test in IDE

How to run tests for bank-ui

npx jest -i

This command runs all tests including CDC tests.-i option execute pact test serially.

npx jest -t account
npx jest -i -t pact
npx jest -i .pact.spec.ts
npx jest .component.spec.ts

npx jest by a filter

How to run accounts microservice standalone

Inside accounts folder run

mvnw spring-boot:run

It starts accounts microservice. accounts microservice uses an in-memory database. It seeds database by sample data on startup. If accessing an external port has limited in your organization, this command (mvnw spring-boot:run) won't work. In the accounts folder run something like flowing command instead.

java -jar target/product1-0.0.1-SNAPSHOT.jar

How to run bank-ui standalone

Inside bank-ui folder in command run

ng serve --proxy-config proxy.conf.json

It starts bank-ui Angular web application. For watching communication logs you can use --verbose option, like this.

ng serve --proxy-config proxy.conf.json --verbose

How to run the whole application by docker compose (accounts,bank-ui)

Inside microservice-test(root) folder in command run

docker-compose -f "docker-compose.yml" up -d --build

It creates related docker images and starts both bank-ui Angular web application and backend accounts microservice containers. This way bank-ui can call backend microservice by its container name and related Url.

Documentation

Learn more about how to test

microservice-test's People

Contributors

javadiahad avatar renovate[bot] avatar

Watchers

 avatar

microservice-test's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm protractor Unavailable
npm tslint Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update dependency eslint to v8.57.0
  • Update dependency jasmine-core to ~3.99.0
  • Update dependency karma to ~6.4.0
  • Update dependency karma-chrome-launcher to ~3.2.0
  • Update dependency karma-coverage to ~2.2.0
  • Update dependency karma-jasmine-html-reporter to ~1.7.0
  • Update dependency maven to v3.9.8
  • Update dependency org.springframework.boot:spring-boot-starter-parent to v2.7.18
  • Update dependency ts-node to ~8.10.0
  • Update dependency tslib to v2.6.3
  • Update dependency typescript to ~4.9.0
  • Update dependency zone.js to ~0.14.0
  • Update jest monorepo (@types/jest, jest)
  • Update typescript-eslint monorepo to v5.62.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • Update Node.js to v20 (node, @types/node)
  • Update angular monorepo to v18 (major) (@angular/animations, @angular/common, @angular/compiler, @angular/compiler-cli, @angular/core, @angular/forms, @angular/platform-browser, @angular/platform-browser-dynamic, @angular/router)
  • Update angular-cli monorepo to v18 (major) (@angular-devkit/build-angular, @angular/cli)
  • Update angularmaterial monorepo to v18 (major) (@angular/cdk, @angular/material)
  • Update dependency @angular-builders/jest to v18
  • Update dependency @ng-bootstrap/ng-bootstrap to v17
  • Update dependency @pact-foundation/pact to v13
  • Update dependency @types/jasmine to v5
  • Update dependency com.github.tomakehurst:wiremock to v3
  • Update dependency eslint to v9
  • Update dependency io.github.bonigarcia:webdrivermanager to v5
  • Update dependency jasmine-core to v5
  • Update dependency jasmine-spec-reporter to v7
  • Update dependency jest-preset-angular to v14
  • Update dependency karma-jasmine to v5
  • Update dependency karma-jasmine-html-reporter to v2
  • Update dependency maven-wrapper to v3
  • Update dependency org.springframework.boot:spring-boot-starter-parent to v3
  • Update dependency rxjs to v7
  • Update dependency ts-node to v10
  • Update dependency typescript to v5
  • Update jest monorepo to v29 (major) (@types/jest, jest)
  • Update openjdk Docker tag to v17
  • Update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
accounts/Dockerfile
  • openjdk 8-jdk-alpine
bank-ui/Dockerfile
  • node 12.11.1-alpine
maven
accounts/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 2.5.4
  • com.github.tomakehurst:wiremock 2.27.2
  • au.com.dius:pact-jvm-consumer-junit 4.0.10
  • io.github.bonigarcia:webdrivermanager 4.4.3
  • au.com.dius:pact-jvm-provider-junit5 4.0.10
  • au.com.dius.pact.provider:maven 4.1.21
cheques/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 2.5.4
  • au.com.dius:pact-jvm-consumer-java8 4.0.10
  • au.com.dius:pact-jvm-consumer-junit5 4.0.10
  • au.com.dius:pact-jvm-provider-maven 4.0.10
maven-wrapper
accounts/.mvn/wrapper/maven-wrapper.properties
  • maven 3.8.1
  • maven-wrapper 0.5.6
cheques/.mvn/wrapper/maven-wrapper.properties
  • maven 3.8.1
  • maven-wrapper 0.5.6
npm
bank-ui/package.json
  • @angular/animations ~11.2.14
  • @angular/cdk ^11.2.13
  • @angular/common ~11.2.14
  • @angular/compiler ~11.2.14
  • @angular/core ~11.2.14
  • @angular/forms ~11.2.14
  • @angular/material ^11.2.13
  • @angular/platform-browser ~11.2.14
  • @angular/platform-browser-dynamic ~11.2.14
  • @angular/router ~11.2.14
  • @ng-bootstrap/ng-bootstrap ^10.0.0
  • bootstrap ^5.1.3
  • rxjs ~6.6.0
  • tslib ^2.0.0
  • zone.js ~0.11.3
  • @angular-builders/jest ^13.0.0
  • @angular-devkit/build-angular ~0.1102.13
  • @angular/cli ~11.2.15
  • @angular/compiler-cli ~11.2.14
  • @pact-foundation/pact ^9.16.5
  • @pact-foundation/pact-node ^10.14.0
  • @types/jasmine ~3.6.0
  • @types/jest ^27.0.2
  • @types/node ^12.11.1
  • @typescript-eslint/eslint-plugin ^5.4.0
  • @typescript-eslint/parser ^5.4.0
  • codelyzer ^6.0.0
  • eslint ^8.2.0
  • jasmine-core ~3.6.0
  • jasmine-spec-reporter ~5.0.0
  • jest ^27.3.1
  • jest-preset-angular ^10.1.0
  • karma ~6.1.0
  • karma-chrome-launcher ~3.1.0
  • karma-coverage ~2.0.3
  • karma-jasmine ~4.0.0
  • karma-jasmine-html-reporter ~1.5.0
  • protractor ~7.0.0
  • ts-node ~8.3.0
  • tslint ~6.1.0
  • typescript ~4.1.5

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.