GithubHelp home page GithubHelp logo

spring-microservices-testing's Introduction

Project Overview

This application is developed to demonstrate how to write the basic unit tests and integration tests for the microservices.

This application contains 2 micro services - department service and employee service which is developed using java,spring framework. Employee service will have the employee details and the department service will have the department details of each employee. Each service has couple of GET and POST Api endpoints

Setup Instructions for the workshop:

Prerequisites

  • Java
  • Maven
  • IntelliJ IDEA (Or any IDE of your choice)
  • MongoDB and Mongo compass (optional if your IDE supports database connectivity)
  • Docker (testcontainers image)
  • Postman
  • JMeter

Installation instructions for Mac

  • Install java and maven

  • Install IntelliJ IDEA edition

  • Install Lombok as a plugin in IntelliJ. (Preferences->Plugins)

  • Enable annotation processing in IntelliJ (Preferences->Build,Execution,Deployment ->Annotation Processors and then enable annotation processing)

  • Install Docker using instructions from here

  • Install Postman and import the collection

  • Do a git clone using https://github.com/QA-Learning/spring-microservices-testing

  • Then Navigate inside the project and perform mvn clean compile

Installation of mongoDB in Mac:

Follow instructions from https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

Installation of Mongodb Compass:

  • In order to view the mongo DB and visually explore your data, you can install MongoDB Compass https://downloads.mongodb.com/compass/mongodb-compass-1.23.0-darwin-x64.dmg

Installation of Jmeter:

  • On Mac you can install jmeter by brew install jmeter
  • On windows please follow the instructions from here

To start the application:

  • Import the cloned repo in IntelliJ as Maven project

  • Allow some time for the IDE to resolve the dependencies.

  • Run /employee-service/src/main/java/com/sample/EmployeeApplication.java and src/main/java/com/sample/DepartmentApplication.java or run mvn spring-boot:run for both the services. (Employee runs in 8080 and department runs in 8081)

  • To test your database connectivity, you can use the connection string as “mongodb://localhost:27017” from your DB client

  • You should see this on the console to be sure that application is properly connected to the mongoDb. INFO 5692 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:7}] to localhost:27017

  • You should see this on the console to be sure that the employee service is running successfully. INFO 5692 --- [main] com.sample.EmployeeApplication : Started EmployeeApplication in 3.403 seconds (JVM running for 9.731

Installation instructions for Windows:

  • Install Java and follow these steps to set path

  • Install Maven. Download the binary zip archive. Follow instructions from here

  • Install IntelliJ Idea from here . You can also use any IDE of your choice

  • Install Lombok as a plugin in IntelliJ. (File->Settings->Plugins)

  • Enable annotation processing in IntelliJ (File->Setting->Build,Execution,Deployment ->Annotation Processors and then enable annotation processing)

  • Install [MongoDB](https://www.mongodb.com/try/download/community?tck=docs_server and follow instructions from https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/)

  • Download the complete installation in case you need the MongoDB Compass too. Else you can download a custom installation. You can select Run the service as Network Service user installation.

  • Install docker desktop for windows

  • In case you don't have a linux kernel installed already, install the linux kernel package from here

  • Install Postman and import the collection

  • Do a git clone using https://github.com/QA-Learning/spring-microservices-testing

  • Then Navigate inside the project and perform mvn clean compile

To start the application:

  • Import the cloned repo in IntelliJ as Maven project

  • Allow some time for the IDE to bring up the dependencies.

  • Run /employee-service/src/main/java/com/sample/EmployeeApplication.java and src/main/java/com/sample/DepartmentApplication.java or run mvn spring-boot:run for both the services. (Employee runs in 8080 and department runs in 8081)

  • To test your database connectivity, you can use the connection string as “mongodb://localhost:27017” from your DB client

  • You should see this on the console to be sure that spring is properly connected to the mongoDb. INFO 5692 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:7}] to localhost:27017

  • You should see this on the console to be sure that the employee service is running successfully. INFO 5692 --- [main] com.sample.EmployeeApplication : Started EmployeeApplication in 3.403 seconds (JVM running for 9.731

spring-microservices-testing's People

Contributors

gptw-lab avatar srinivasantarget avatar

Stargazers

 avatar

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.