google / google/acai

Provide a clean way to stop services

Open
#4 2 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
82
Forks
30
PR merge metrics
No merged PRs in 30d

Description

Currently TestingService classes can provide a `@BeforeSuite` method but there is no corresponding `@AfterSuite`. This means if you start a bunch of services in the `@BeforeSuite` method there is no easy way to stop them when you are done testing.

One work around is to attach a JVM shutdown hook in your `@BeforeSuite` method but this is a bit ugly.

RunListener#testRunFinished in JUnit is basically what we need but a RunListener can only be attached via JUnitCore which would mean forcing users to implement their own main method or use one we provide. That seems much too intrusive.

The proposal in junit-team/junit#874 may be useful in implementing this but we would need something that could attach the listener while still only requiring the user to add one thing to their tests. Telling people to add the Acai `@Rule` and also to register a listener for things to work correctly would be too onerous. Probably Acai could be implemented as a listener rather than a rule.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.