One or more requested classes are not Suites

1,673 views
Skip to first unread message

Michael Slinn

unread,
May 14, 2012, 4:24:13 PM5/14/12
to scalate...@googlegroups.com
Seems this is not a Suite ("One or more requested classes are not Suites"). Any idea why?

import akka.actor.ActorSystem
import org.scalatest.{BeforeAndAfterAll, WordSpec}
import org.scalatest.matchers.MustMatchers
import akka.testkit.TestKit

class TestTest(implicit system: ActorSystem = ActorSystem()) extends TestKit(system) with WordSpec with BeforeAndAfterAll with MustMatchers {

  override protected def beforeAll: Unit = { }

  override protected def afterAll(): Unit = { }

  "Simon says you" must {
    "rub your stomach" in { }

    "pat your head" in { }
  }
}

Mike

Derek Wyatt

unread,
May 14, 2012, 6:01:47 PM5/14/12
to scalate...@googlegroups.com
You can't do that. You have to have a bonafide zero-argument ctor.
Sent from my BlackBerry

From: Michael Slinn <msl...@gmail.com>
Date: Mon, 14 May 2012 13:24:13 -0700 (PDT)
Subject: [scalatest-users] One or more requested classes are not Suites
--
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

Bill Venners

unread,
May 14, 2012, 6:21:43 PM5/14/12
to scalate...@googlegroups.com
Hi Mike,

Derek is correct. I'll improve that error message. Must be public with
a public no-arg constructor.

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



--
Bill Venners
Artima, Inc.
http://www.artima.com

Michael Slinn

unread,
May 14, 2012, 7:40:17 PM5/14/12
to scalate...@googlegroups.com
Hmm, my code is taken almost verbatim from the Akka testing docs

http://doc.akka.io/docs/akka/snapshot/scala/testing.html#Integration_Testing_with_TestKit

class MySpec(_system: ActorSystem) extends TestKit(_system) with ImplicitSender with WordSpec with MustMatchers with BeforeAndAfterAll { ...

Mike

Michael Slinn

unread,
May 14, 2012, 7:42:16 PM5/14/12
to scalate...@googlegroups.com
Duh, except for this line:

def this() = this(ActorSystem("MySpec"))

I guess I was in the sun too long while salmon fishing yesterday.

Mike

Derek Wyatt

unread,
May 14, 2012, 7:45:17 PM5/14/12
to scalate...@googlegroups.com
There's an alternative to this as well, that I discovered today.  You can push the TestKit (and thus the ActorSystem) down to the tests, as opposed to at the suite.  This isn't always useful but it can be, depending on your situation.


Regs,
Derek

signature.asc

Mike Slinn

unread,
May 14, 2012, 8:08:39 PM5/14/12
to scalate...@googlegroups.com
Nice! I'm probably going to need that feature in a few days.

Mike
Reply all
Reply to author
Forward
0 new messages