Behaviour Modelling for Consumer Driven Contracts

In this thesis, the concept of consumer-driven contracts was adapted to specify the communication behaviour of services. Thereby, this research focused on microservice-oriented, event-driven architectures. Furthermore, a concept was developed, firstly, to capture the actual communication behaviour of services and secondly, to check the conformity of this behaviour model with the behaviour specification of the contracts. The developed concept includes the reuse of existing system tests to reduce the effort needed to integrate the concept. Additionally, it has turned out that for a better validation of the behaviour model, Property-Based Testing (PBT) is a viable technology. Furthermore, related research on the topic on consumer-driven contract testing has shown that it is well suited to ensure the compatibility of a set of clients and a server. Therefore, the most common contract-testing frameworks (e.g. Pact and Spring Cloud Contract) focus on this area, precisely Http based communication of a fixed set of clients with one server. However, a trend in software architecture is event-driven, microservice-oriented architecture. Therefore, these frameworks often provide approaches for messaging. Nonetheless, this is not their main use case and they nearly always focus on the pure syntax of messages. Therefore, this thesis aims to extend the usability of consumer-driven contracts towards behaviour, semantics and messaging. The research goal was the development of the named concepts and the implementation of a prototypic framework. After that, the results where evaluated. This was done firstly, by applying the developed framework to a demo application and secondly, by mutating this application and observing if these mutations where detected. The major finding was that PBT is not always a suitable technology for writing system tests. However, if it is used the expressiveness of the validation is improved drastically. Furthermore, the structured evaluation via mutation showed, that most of the mutations were discovered. However, if the absence of a process should be conditioned by a contract, this is not possible to define. Notwithstanding of these problems, the concept and the prototype have proven to be usable and to be a reliable foundation for further research in this area.

Project information



Thesis for degree:



Viktor Schneider