Hi Dominik,
The way you mix these together, the order of initialization will cause
COSISuite to be initialized first. It calls testcasesForProofs in
COSIPerSpecSuite, which calls createTests in TestsForSteps, which
calls test in FunSpecLike. But FunSpecLike hasn't been initialized yet
because that will be initialized after COSISuite. One way you could
fix that is make COSISuite a trait, then mix TestForSteps in *before*
COSISuite in COSIPerSpecSuite, like this:
import org.scalatest.Suite
trait COSISuite extends Suite {
def constructTestcases() {
println("constructTestcases")
testcasesForProofs()
}
def testcasesForProofs()
constructTestcases()
}
import org.scalatest.FunSuiteLike
trait TestsForSteps extends FunSuiteLike {
println("Init TestsForSteps")
def createTests(i:Int) = {
println("createTests: " + i)
test("Test " + i){ assert(1 == 1) }
}
}
class COSIPerSpecSuite extends TestsForSteps with COSISuite {
override def testcasesForProofs() {
(1 to 2) foreach ((i:Int) => {
println("testcasesForProofs: " + i)
createTests(i)
})
}
}
Paste that into the REPL and you'll get:
scala> new COSIPerSpecSuite
Init TestsForSteps
constructTestcases
testcasesForProofs: 1
createTests: 1
testcasesForProofs: 2
createTests: 2
import org.scalatest.Suite
defined trait COSISuite
import org.scalatest.FunSuiteLike
defined trait TestsForSteps
defined class COSIPerSpecSuite
res2: COSIPerSpecSuite = COSIPerSpecSuite@ce99a05
Bill
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to
scalate...@googlegroups.com
> To unsubscribe from this group, send email to
>
scalatest-use...@googlegroups.com
> For more options, visit this group at
>
http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
>
http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
scalatest-use...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
Bill Venners
Artima, Inc.
http://www.artima.com