mardi 3 novembre 2015

specs2 - how to use the same variable inside around and inside the test itself?

I am using specs2 as my test framework. I want to generate a uniq key that will be available in the test itself.

def around[R: AsResult](r: => R): Result = {
   val uniqueToken = before()
   try AsResult(r)(uniqueToken)
   finally after(uniqueToken)
}

"foo" should {
   "bar" in {
     do something with uniqueToken
   }
}

Couldn't find any good way to do it.. Any idea?

Aucun commentaire:

Enregistrer un commentaire