Final cleaning in specs2

I am writing specs2 Unittest for my scala software. Execution works well. The only problem I encountered is that I need to clean up after all tests have completed. I just can't find a solution for this. Is there a way to perform some functions after completing all tests?

+7
source share
2 answers

You need to add Step at the end of your specification:

import org.specs2.mutable._ class MySpec extends Specification { // lots of examples here // cleanup there step(cleanUp()) } 
+9
source

You can try using After with After and implement the def after function.

Example:

 class Context extends Specification { .... } trait trees extends mutable.After { def after = cleanupDB } 
0
source

All Articles