Frage

I want to share a Database / Knowledge base, for a suite of test. I want it to be available for any test suite. I am using featureSpec

Following the Documentation, I use fixture.FeatureSpec.

As of now i have defined the following:

trait InteractionKbFixtureTrait { this: fixture.Suite =>

type FixtureParam = InteractionKB

def withFixture(test: OneArgTest): Unit = {

    val kb = KbFactory.createKb("", "") // create the fixture

    try {

     this.withFixture(test.toNoArgTest(kb)) // "loan" the fixture to the test

    } finally { 

//kb.stop() // clean up the fixture

}

}

}

followed by

class ExampleSpec extends fixture.FeatureSpec with InteractionKbFixtureTrait {


}

I get the following error :

Type overriding method withFixture in trait Suite of type (test: ExampleSpec.this.OneArgTest) org.scalatest.Outcome; method withFixture in trait InteractionKbFixtureTrait of type (test: ExampleSpec.this.OneArgTest) Unit has incompatible type InteractionKbFixtureTrait.scala

Any help ?

War es hilfreich?

Lösung

Method def withFixture should return type org.scalatest.Outcome, whereas your def withFixture is returning Unit. Error message is saying that quite clearly.

So for fixing it you need to change line:

def withFixture(test: OneArgTest): Unit = {

like so:

def withFixture(test: OneArgTest): org.scalatest.Outcome = {
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top