Is It Okay To Stop Running Your Tests After the First Failure?

Running tests is the necessary evil. I have never heard two or more engineers at the water cooler talking about the joys of test execution. Don't get me wrong, tests are great; you should definitely have plenty of them in your project. It is just not a pleasant experience to wait for their execution. If they start to fail, that is even worse. Most probably, someone could become very popular if they could reliably tell which tests will fail before executing them. As for the rest of us, I think we should keep running our tests.

Can We Somehow Reduce the Execution Time at Least?

We can at least try! We could start by understanding the problem more and looking at solutions later.

Keep Your Application Secrets Secret

There is a common problem most backend developers face at least once in their careers: where should we store our secrets? It appears to be simple enough, we have a lot of services focusing on this very issue, we just need to pick one and get on the next task. Sounds easy, but how can we pick the right solution for our needs? We should evaluate our options to see more clearly. 

The Test

For the demonstration, we can take a simple Spring Boot application as an example. This will be perfect for us because that is one of the most popular technology choices on the backend today. In our example, we will assume we need to use a MySQL database over JDBC; therefore, our secrets will be the connection URL, driver class name, username, and password. This is only a proof of concept, any dependency would do as long as it uses secrets. We can easily generate such a project using Spring Initializr. We will get the DataSource auto configured and then create a bean that will do the connection test. The test can look like this: