Sometimes, you want to push test results to your team chat automatically.
For example, in my current job, we associate sections of E2E tests with specific teams. When a test related to their functionality fails, they need to be notified so they can take a look.
Sometimes I come across a test that fails under unknown circumstances, and I just can’t reproduce it right now. But I want to be alerted when it happens again, so I can investigate.
With these usecases in mind (and mostly as a fun hobby project), I built Alerticorn — a lightweight framework that makes sending notifications to team chats as easy as possible.
How Alerticorn Works
Currently, Alerticorn extends JUnit 5, listening to results from test classes and test methods. If necessary, sends an alert to Slack, Teams or Discord.
With the right configuration in place, sending a chat message is as simple as this:
@ExtendWith(MessageExtension::class)
class MyTest {
@Message(title = "The flux capacitator failed")
@Test
fun `flux capacitator test`() {
// your test
}
}
Messages can be:
- Routed to different platforms and channels
- Customised with more information
- Generated with details from thrown exceptions
- Filtered based on the outcome of the test
What’s Next? TestNG and Kotest Support
Currently, Alerticorn supports JUnit 5, but I plan to add support for TestNG and Kotest , making it useful regardless of your test framework.
Directly calling RunWith.message is already supported, offering more flexibility for different use cases.
The Philosophy Behind Alerticorn
Alerticorn is built with a few core principles in mind:
- Convention over configuration — The defaults cover most use cases, but you can configure it fully if needed.
- No unnecessary dependencies — It’s designed to be lightweight.
- Extensibility — A plug-in system allows easy integration with other chat platforms or test runners.
- Learning and fun — This project has been an excellent way to explore Kotlin, ServiceLoader, AI-assisted coding, Javadoc/KDoc, technical documentation (Docusaurus), Maven Central publishing, GitLab Actions, and more.
Curious?
Do you want to try it out? See a use case for it? Or maybe you think it’s a silly idea? Either way, I’d love to hear your thoughts in the comments.
In the meantime, you can find the documentation and source code on GitHub.
Top comments (0)