davidB / scala-maven-plugin

The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code in maven.
https://davidb.github.io/scala-maven-plugin/
The Unlicense
562 stars 151 forks source link

Provide a method by which code can be executed after ALL suites have finished #282

Closed aosama closed 6 years ago

aosama commented 6 years ago

The ask here would be to implement a test listener similar to Junit mentioned in the article below.

in some cases we need to do cleanup after all the suites have finished execution.

public class TestListener extends RunListener { @Override public void testRunStarted(Description description) throws Exception { // Called before any tests have been run. } @Override public void testRunFinished(Result result) throws Exception { // Called when all tests have finished } }

https://stackoverflow.com/questions/9903341/cleanup-after-all-junit-tests

slandelle commented 6 years ago

How is this related to this plugin? Just use the maven-failsafe-plugin.

aosama commented 6 years ago

An example would be spark unit testing ... the execution would look something like this (a) create a spark context (runs in the proposed "testRunStarted" before any suite executes) (b) run all the suites (c) stop the spark context (runs in the proposed "testRunFinished" after all suites finished executing)

an example for database dependent testing would be (a) setup DB instance (runs in the proposed "testRunStarted" before any suite executes) (b) execute all test suites (c) stop the spark context (runs in the proposed "testRunFinished" after all suites finished executing)

currently in this plugin we cant do that, the only option is to use sequential suites or combine them into a higher level suite, which is not very practical.

slandelle commented 6 years ago

But this plugin has nothing to do with running tests! It's a "just" glue between maven and the scala compiler. Running tests is what surefire and failsafe do.

aosama commented 6 years ago

OMG i posted this issue in the wrong repo :) i meant to post it here https://github.com/scalatest/scalatest-maven-plugin/issues

slandelle commented 6 years ago

^^

davidB commented 6 years ago

Thanks @slandelle for the quick replies.

slandelle commented 6 years ago

@davidB The best I can do here to help is sometimes with triaging issues :)