Consumer-Driven Contract Testing: A Framework and Pilot Implementation

Loading...
Thumbnail Image

URL

Journal Title

Journal ISSN

Volume Title

Sähkötekniikan korkeakoulu | Master's thesis

Date

2022-08-22

Department

Major/Subject

Control, Robotics and Autonomous Systems 2020-2022

Mcode

ELEC3025

Degree programme

AEE - Master’s Programme in Automation and Electrical Engineering (TS2013)

Language

en

Pages

67

Series

Abstract

Microservice architecture is the latest mega-trend of software architecture. There is no strict definition for microservice architecture, but it embodies the principle of splitting a software system into several smaller, independently deployable services. Although there is no strict definition of microservices, there are a few cornerstones that the architecture relays on, such as one business application per service and automated infrastructure. The recent gain of popularity has resulted from big tech corporations successfully adopting microservice architecture and promoting it. The microservice architecture allows corporations to rapidly develop and deploy new features to their customers. Microservices provide a lot of flexibility and speed to the development process. However, microservices do not come without downsides. One of the most prominent downsides is that the points of failure outside the software system increase since the microservices have to communicate. Different standardized communication protocols, such as REST (Representational State Transfer) and gRPC (Remote Procedure Call), streamline inter-service communication. Even though these standardized protocols make this communication more fault-tolerant, it does not guarantee that the different services will be compatible. A solution to this compatibility issue is consumer-driven contract testing. This testing approach allows the service user to define its expectation of the producer service interface as a contract. This contract contains the expected response to a specific query to the service. This thesis developed a testing framework that allows for consumer-driven contract testing for REST and gRPC communication to make this process as straightforward as possible. The implementation is validated through design science research, including interviews, benchmarking, and a real-world simulation

Mikrotjänstarkitektur är den senaste megatrenden inom mjukvaruarkitektur. Mikrotjänstarkitektur har ingen strikt definition, utan är snarare ett sätt att dela upp en programvarutjänst i flera mindre tjänster som kan användas oberoende av varandra. Även om det inte finns någon strikt definition av mikrotjänster finns det definitivt några grundprinciper som arkitekturen bygger på, t.ex. ett affärsområde per mikrotjänst och automatiserad infrastruktur. Den senaste tidens ökade popularitet av mikrotjänstarkitektur har varit en följd av att stora teknikföretag framgångsrikt har anammat denna arkitekturstil. Som en följd av detta har dessa företag snabbt kunnat utveckla och distribuera funktionalitet till sina kunder. Mikrotjänster ger flexibilitet och snabbhet till utveckling processen. En av de mest tydliga nackdelarna med mikrotjänster är att felpunkterna utanför programvarusystemet ökar, eftersom mikrotjänsterna måste kommunicera med varandra via webben. För att göra denna kommunikation så smärtfri som möjligt finns det olika standardiserade kommunikationsprotokoll, så som REST (Representational State Transfer) och gRPC (Remote Procedure Call). Även om dessa standardiserade protokoll gör kommunikationen mer feltolerant, garanterar de inte att de olika tjänsterna är kompatibla med varandra. En lösning på detta kompatibilitetsproblem är konsumentstyrd kontraktstestning. Detta är en testmetod där användaren av en tjänst definierar sina förväntningar på producentens tjänstegränssnitt som ett kontrakt. Kontraktet innehåller det förväntade svaret på en specifik förfrågan till tjänsten. För att göra denna process så enkel som möjligt har man i denna avhandling utvecklat ett testramverk som möjliggör konsumentdriven kontraktstestning för både REST- och gRPC-kommunikation. Genomförandet valideras också genom designvetenskaplig forskning som omfattar intervjuer, prestandajämförelse och en simulering i den verkliga världen.

Description

Supervisor

Lassenius, Casper

Thesis advisor

Huovinen, Petri

Keywords

microservices, software testing, consumer-driven contract testing, DevOps

Other note

Citation