Code Monkey home page Code Monkey logo

spring-mvc-boot-autotesting's Introduction

Автотестирование REST API на Spring MVC + Boot

18 ак. ч., 6 дней.

Архитектура приложения

structure

puml
@startuml
frame frontend
frontend -> tomcat

database DB #white
database MQ #white
component [LegacyRestService] #white

frame backend {
  frame tomcat {
    component [SpringMVC] #white
    
    frame spring {
      component [RestTemplate] #white
      component [JpaProvider] #white
      component [JdbcTemplate] #white
      
      frame "application feature" {
        component [Repository] <<codegened>> #lightgray
        [Controller] -> [Service]
        Service -> [Repository]
        Repository --> JpaProvider
        JpaProvider --> JdbcTemplate
        
        Service --> RestTemplate
        RestTemplate -> LegacyRestService
      }
    }
    
    component [DbConnectionPool] #white
    JdbcTemplate --> DbConnectionPool
    DbConnectionPool -> DB
    
    spring ..> Controller
    spring ..> Service
    spring ..> Repository
    spring ..> JpaProvider
  }
  
  tomcat -> SpringMVC
  SpringMVC -> Controller
}


@enduml

Тестирование Spring Core приложения

Модульные тесты со Spring Core: Тест-дублеры

Интеграционные тесты со Spring MVC: Тестирование REST API

Системные тесты со Spring MVC: Тестирование c БД

Тестирование Spring Boot приложений

Модульные тесты со Spring Boot: Тест-дублеры

  • Интеграция Mockito и Spring Boot: @MockBean

Интеграционные тесты со Spring Boot: Тестирование REST API

  • Специальный вид тестов @WebMvcTest
  • webEnvironment и @LocalServerPort

Системные тесты со Spring Boot: Тестирование c БД

Тест-дублирование окружения приложения: внешние сервисы

  • Специальный вид тестов @RestClientTest
  • Spring MockRestServiceServer
  • Альтернативные тест-дублеры внешних web- и REST-сервисов
  • MockServer
  • Wiremock
  • Контейнеризация окружения при тестировании приложения
  • TestContainers

Особенности тестовой конфигурации

spring-mvc-boot-autotesting's People

Contributors

eugene-krivosheyev 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.