Automated Security Checks
Podcast Episode: Automated Security Checks In the current episode, we look at the importance of security tests in software development. Security...
APIs are the nerve centers of digital products. When teams grow and systems change more quickly, trust is lost without clear contracts. There are two ways to ensure reliable interfaces. Versioned OpenAPI specifications, coupled with Renovate, make changes transparent and keep dependencies clean, but they primarily check the syntax. Consumer-driven contract testers with Pact provide more technical security. The consumer formulates expectations, the Pact broker provides mocks, and the pipeline aborts releases in the event of contract violations. This results in fast feedback without a counter system.
In this episode, I talk to Andrej Thiele about API testing. Andrej shows two practical ways. First: Versioning OpenAPI and using Renovate to make dependencies and changes visible. Second: Consumer-driven contract testing with Pact. The consumer defines expectations, Pactbroker provides mocks and JUnit integrates it into the pipeline. If contracts break, the release stops. But teams still have to talk.
"It's always a good idea to base this on OpenAPI and simply generate your interface, because it also saves a lot of work when programming and is not so error-prone." - Andrej Thiele
After graduating in computer science at TU Dortmund University in 1999, Andrej worked as a software developer for companies in various areas of industry, e.g. digitization of radio stations, telecommunications, mobile and embedded devices. In 2008, he switched to consulting and worked there as a senior consultant in various projects in the role of developer, architect, technical project manager and test coach for developers. Since 2016, he has been working at Conciso GmbH, where he organizes a regular Coding Dojo as a MeetUp and is Topic Lead for quality assurance in the further training of internal employees and the implementation of training courses for customers. He is also a regular speaker at various conferences.
APIs determine our everyday digital lives. They connect systems, make apps possible and ensure that data flows securely and efficiently. Nevertheless, many questions remain unanswered: How do you test APIs in a meaningful way? What methods are there? And how do you build them so that errors are detected quickly? This was the subject of Richie's discussion with André Thiele and André Thiele at the Tacon conference.
API testing often starts quite simply: the teams talk to each other. They sit down together, go through the requirements and agree on them. This sounds logical, but can quickly cause problems in everyday life. Perhaps teams work at different locations. Maybe they don't understand each other properly. And in the end, there is no clear definition of what the interface is really supposed to do.
That's why it's not just about talking. André Thiele shows that planning is important, but real quality requires more: structured testing and tools that help to detect errors at an early stage.
There are several approaches to testing APIs. One fairly common way is repository-based testing.
This is how it works: You describe the API interface cleanly once, for example with OpenAPI. This file is stored in version management and can be monitored by tools such as Renovate. Whenever something changes in the interface, Renovate reports this. It makes automatic merge requests, updates versions and helps to keep track of changes.
It sounds simple, but there is a catch: you only check the structure and syntax. How exactly data flows, whether certain values are required or permitted, is not noticed at first. The example with enums shows it: If a developer changes permitted values, the syntax check does not necessarily see this. Errors are therefore noticed later.
This is where you start with the end user. Tools such as PACT are used. The principle: it is not the developer of the interface who defines what is tested, but those who use the interface. Each consumer describes examples, i.e. what they send and what they expect back. This information ends up in so-called contracts and serves as a template for automated testing.
The advantage: this allows you to check whether the API really works as planned - and with real content, not just an empty shell. Several consumers can cover different areas of the interface. This creates a real, living test system.
Contract testing provides real security, especially in projects with several teams, microservices and many interfaces. Failures in testing stop the delivery of the software. Only when everything is right can it continue. Errors are noticed more quickly and can be addressed in a targeted manner. Nevertheless, talking is still necessary. "It doesn't work completely without exchange," says André Thiele.
In everyday life, mixed forms are often used: You might start with syntax checks and then gradually build in more contract tests. In the Java environment, the tests themselves are often written as simple JUnit tests and can therefore be hooked into any automation pipeline. You can see changes and results directly when building the software.
The effort is limited if you know your way around a little. Many tools are available as Docker containers. With a little practice, you can set up an entire environment in a weekend. If you're new to it, it takes longer - but everything grows with time. You can also start small and connect more consumers and producers later.
APIs are the backbone of modern software. They need clear contracts and good testing. Whether a repository-based approach or contract testing: each team must decide how much security and automation is appropriate. The best thing? You can grow and create more and more quality and transparency. In the end, testing pays off. With good APIs, there are fewer nasty surprises - and the teams understand each other better, even if they still have to talk.
Podcast Episode: Automated Security Checks In the current episode, we look at the importance of security tests in software development. Security...
Podcast Episode: C++ Quality by Design C++ is a living dinosaur among programming languages that has been in use since the late 1970s. That's over 40...
Podcast Episode: Shift Left The idea behind Shift Left is to consider quality as early as possible in the development process. Because the later...