Return to site

🧪⚡ Are your TESTS SLOWING you DOWN or SAVING you TIME?

· testing

Tests can feel slow.

They take time to write, failures can be difficult to investigate, flaky tests create noise, and large suites can delay feedback.

But the lesson from Java Champion Trisha Gee is not: write fewer tests.

It is: invest in better tests and a faster testing workflow.

🔸 TLDR

The typing is rarely the real bottleneck.

The difficult (and valuable) part is thinking about:

▪️ How should the system behave?

▪️ What happens with invalid data?

▪️ What if a dependency becomes unavailable?

▪️ Which edge cases have we forgotten?

AI may generate test code or test data, but it cannot replace the engineering judgment needed to define the correct behaviour.

🔸 MAKE FAILURES USEFUL

A test provides the most value when it fails.

Names such as testIncrement() and assertions such as assertTrue() often provide too little information.

Prefer descriptive names, clear expected-versus-actual assertions and a Given/When/Then structure.

A failure should help developers understand:

▪️ What behaviour was expected

▪️ What actually happened

▪️ Where the investigation should begin

🔸 DO NOT NORMALISE FLAKY TESTS

Rerunning a failing test until it passes does not fix it.

A flaky test may reveal race conditions, shared state, timing problems, infrastructure instability or uncontrolled dependencies.

Quarantine it temporarily when necessary, but give it an owner, a deadline and a path back into the reliable suite.

🔸 REDUCE THE FEEDBACK LOOP

You do not always need to run every test after every change.

Depending on the project, teams can use:

▪️ Build caching

▪️ Parallel execution

▪️ Test distribution

▪️ Predictive test selection

▪️ More isolated and faster tests

▪️ Mocked clocks and external dependencies

The goal is not merely a green pipeline. It is fast, trustworthy feedback.

🔸 TAKEAWAYS

▪️ Tests require the same engineering discipline as production code.

▪️ AI can assist with boilerplate, data and edge-case ideas, but you remain responsible for correctness.

▪️ Clear tests are easier to troubleshoot and maintain.

▪️ Flaky tests are defects, not background noise.

▪️ Refactor or remove tests that no longer provide unique value.

▪️ Automated tests are also living documentation of expected system behaviour.

This post is inspired by the talk “Are Your Tests Slowing You Down?” by Java Champion Trisha Gee.

🎥 Watch the full talk:

#Java #Testing #UnitTesting #SoftwareTesting #TestAutomation #JUnit #TDD #SoftwareEngineering #DeveloperProductivity #ContinuousIntegration #DevOps

Go further with Java certification:

Java👇

Spring👇

SpringBook👇

JavaBook👇