LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Test Driven

When an organization adopts microservices architecture, a CI/CD pipeline is essential to ensure the quality of the delivery. Unlike common practices for monolithic applications, which involve applying the integration test after the entire application is completed, we need continuous integration from day one.

When using light-platform to build microservices, two use cases need continuous integration:

  • Often a team of developers focuses on middleware handlers that are shared by numeric microservices. These developers need to do integration tests with microservices built by other teams to ensure that any changes in these middleware handlers will not break any microservices.

  • When breaking a big monolithic application into smaller pieces, one developer might be responsible for one or more services. If there are dependencies between services, these services need to be tested together although they can be developed and deployed independently. There is no need to wait until all services are completed. The integration test should be started on day one and integrated one endpoint each time.

There are four different testing levels supported by the platform. You can also find tutorials to learn how to use these types of tests in light-platform.

Unit Test

Unit test cases are designed to test utility classes or classes called from business handlers. They need to be created by the user manually while developing the application or service. These test cases should run fast as they will be executed every time a developer is calling the mvn package.

Integration Test

Integration test cases rely on the target server to be up and running to hit the live server to perform the tests. When light-codegen scaffold a new project, it includes one integration test case per endpoint. Also, a test server is generated to start the server with all the default configurations except server.yml to listen to a different port. You should write as many test cases as possible to test all positive and negative scenarios.

Consumer Contract Test

Consumer contract testing is not new, but with the mainstream acceptance of microservices, people realize that consumer-driven contracts are an essential part of a mature microservice testing portfolio. However, we want to point out that consumer-driven contract testing is a technique and an attitude that requires no special tool to implement. Frameworks like Pact make proper contract tests easier to implement. However, we should not focus on the framework but the general practice. Writing Pact tests is not a guarantee that you are creating consumer-driven contracts. Likewise, in many situations, you should be creating good consumer-driven contracts even where no pre-built testing tool exists.

End-to-End Test

End-to-End testing involves all dependent services and upstream/downstream services. They need to be tested together to ensure all the services can work in concert. It used to be very hard to do, but with Docker and cloud environments, it is relatively easy to perform with proper tools. We found that all existing DevOps tools are too monolithic focused and they are not suitable to design pipelines for microservices which have multiple repositories. This is why we have built light-bot for building and end-to-end testing.

  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“Test Driven” was last updated: October 5, 2021: add server life cycle doc (9788c26)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute