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?
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()) }
You can try using After with After and implement the def after function.
with After
def after
Example:
class Context extends Specification { .... } trait trees extends mutable.After { def after = cleanupDB }