sebastiandaschner blog

Video course on efficient enterprise testing

#testing thursday, january 09, 2020

I’ve created a few videos on the topic of effective enterprise testing. I still see a huge importance in this topic in real-world projects. Here are my experiences in testing Enterprise Java projects together with some examples.


1. Introduction & efficient Maven usage

In this video, I’ll give an introduction to the testing course and show how to structure tests in standard enterprise projects with Maven. We’ll see the difference between Maven Unit tests and integration tests with surefire and failsafe, respectively, and how to efficiently use the Maven conventions. Our goal is to achieve fast Maven builds with a minimalistic setup.


2. Unit tests

In this video, I’ll show how to build up simple unit tests which execute quickly, using JUnit, Mockito, and AssertJ. We’ll see the pros & cons of unit tests, especially when it comes to refactoring production code. We’ll have a look for which cases such straightforward unit tests make sense.


3. Use case tests

In this video, I’ll show the approach behind so-called use case tests. Use case tests aim to verify the execution of a business use case including all involved components excluding all external concerns, such as HTTP gateways or database access. In order to ensure that use case tests run quickly, without starting up parts of the application, we use plain JUnit here, as well. To make our tests maintainable, we come up with reusable test doubles, that extend the involved classes in the production scope. In the video, we’ll see how the approach works with example code.


4. System tests — part 1

In this video, I’ll show code-level integration tests which simulate parts of the application and the shortcomings thereof. We’ll see that, with regards to the overall test and feedback time, it is more efficient to focus on end-to-end integrative tests. In the video, I show the manual approach of how we could verify our application in a later system test by manually connecting to the example application.


5. System tests — part 2

In this video, I’ll show how to build up integrative tests that connect to the application under test in the same way like a client does. We’ll see how to make the sometimes complex scenarios more maintainable by introducing abstraction and separating concerns into delegates. We’ll compare a na├»ve approach against a test that makes use of code quality and we see the different in maintainability. We have a look at the benefits of separating the test life cycle from the test environment life cycle. I’m also showing a way how to make the turnaround cycles really fast by using some hot-reload technology that allows developers to locally change production code and get very fast feedback within one second.


6. System tests — part 3

In this video, I’ll show a system test project structure with a separate project, and the motivation therefore. We’ll see examples for more complex system tests, that reside in the system test project, and how to connect to and control a mock server, where I use WireMock in my example. The system test examples that involve a mock server verify the communication between the application-under-tests and external microservices. We will once again make use of abstraction and delegation to make our acceptance tests readable and maintainable. We ensure reusability by separating the test life cycle from the test environment life cycle which especially benefits us once we have more complex examples.


7. Efficient development workflows

In this video, I’ll show how to craft efficient development workflows. We’ll see the benefit of using plain and simple technologies to build up the local development workflow. We’ll have a look at the motivation for local development and test environments and how it connects to proper CI/CD workflows. I’ll show how to run system tests environment on a production-like environment with Kubernetes and how to reuse the same system tests that we wrote before.


8. Test code quality

In this video, I’ll show how to improve the test code quality, readability, and maintainability, with abstraction layers and delegation by separating concerns. We’ll see how delegation outsources lower-level logic such as handling individual execution, verification, or mocking. We’ll see that these principles should be applied for all test scopes, whether we’re dealing with code-level tests, or integrative application-level scenarios.


9. Test technology & frameworks

In this video, I’ll cover the test technology that I usually advice to use in enterprise projects. We’ll have a look at JUnit, Mockito, AssertJ, the importance that tests run fast, speed of technology, and test life cycles. As other example technologies I’ll mention Testcontainers, AssertJ, Cucumber Tests and, once again, the importance of test code quality. I’ll also summarize the points made in these video series.


Bonus: Tests that spark flow — a poem


Further resources

I hope this content was helpful. Happy testing!


Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java: