JUnit Test Visualisation with Mermaid and Kotlin
ฝัง
- เผยแพร่เมื่อ 5 ก.พ. 2025
- They say a picture is worth a thousand words. Because I’m that sort of person, I checked and there are 957 words in the text representation of our test runtimes. Hidden in that data is information about which tests ran first, which took longest, which ran in parallel with others, and which are on the critical path.
Great engineers know when to use text and when to use diagrams, so let’s look as visualising our tests.
In this episode
00:00:30 Review of our test runtime data
00:01:38 A Gantt chart feels like a good fit
00:02:38 Can't somebody else do it?
00:04:11 IntelliJ fails to offer to import java.io.File?
00:04:52 Iterate on the AI solution
00:06:53 Our data clashes with the diagram syntax
00:07:44 but now we have problems escaping in our Kotlin source
00:09:16 Increase the time resolution to show quick tests
00:09:57 Now what about containment?
00:10:26 Prototype by hand editing
00:11:14 and then change the code to match
00:13:10 A little light polishing
00:14:48 Finally sort earlier starting tests higher
There is a playlist of TDD Gilded Rose episodes - • Test Driven Gilded Ros...
The codebase is available on GitHub github.com/dmc...
If you are going to be at KotlinConf 2025, or even just in Copenhagen in May, then you should sign up for the workshop that Nat Pryce and I are running. It’s called Refactoring to Functional Kotlin, and will give you hands-on experience of taking legacy code and safely migrating it to a functional style. Places are limited, so buy now at kotlinconf.com...
If you like this video, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook (java-to-kotlin.dev). It's about far more than just the syntax differences between the languages - it shows how to upgrade your thinking to a more functional style.
❤ thanks, from Vietnam 😊
I’m pleased to get positive feedback. Thank you.
Happy end of year celebrations!
And to you! My wife bought me some bottle of La Chouffe, so I can have Ardennes flashbacks!
Maybe it‘s worth to measure before/after methods in Addition? Could be that test prepartion consumes a lot of time?
Wait for it, wait for it! Actually that’s surprisingly hard to add to the diagram- watch this space.
I should also say that I believe that the times here are including everything it takes to run a test, so including the setup and teardown.
2:34 😆
😅