The Artima Developer Community
Sponsored Link

ScalaTest/ScalaUtils Forum
How to use both both Funspec and Funsuite (or FunspecLike and FunsuiteLike)

1 reply on 1 page. Most recent reply: Feb 26, 2015 4:10 PM by Bill Venners

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Han Wei

Posts: 2
Nickname: akkathinke
Registered: Feb, 2015

How to use both both Funspec and Funsuite (or FunspecLike and FunsuiteLike) Posted: Feb 26, 2015 1:01 PM
Reply to this message Reply
Advertisement
Hi
I am trying to write a ScalaTest class as follows:

class MyActorUnitTest extends FunSpec
with MustMatchers
with ScalaFutures
with BeforeAndAfter
with FunSpecLike{

test("Test my actor's behaviour")



}

Now, when I try to compile or run sbt test it complains that
I would also like to leverage the Akka Test Kit. So i tried writing as below.
But I cannot compile it again, because it complains that I can't use both Funspec and Funsuite at the same time. Besides And the test() method is only available if I extend from Funsuite or (mix in) the Funsuite
Trait.

And, if I do something like below.

class MyUnitTest(_system: ActorSystem) extends TestKit(_system)
//with FunSpecLike
with FunSuiteLike
with ScalaFutures
with MustMatchers
with BeforeAndAfter {

test("...")

}

It works. And it does not complain about "test()".

If I leave out FunsuuiteLike and bring in FunSpecLike, then I can't bring in "test()".

class MyActorUnitTest(_system: ActorSystem) extends TestKit(_system)
with FunSpecLike
//with FunSuiteLike
with ScalaFutures
with MustMatchers
with BeforeAndAfter {

test("...") //this cause it to not compile or sbt test fails

}'

So, what do I do? I am not so familiar with the practice of mixing in traits, it seems.

I would like to use both FunspecLike and FunSuiteLike and I would like TestKit as shown above.

Please advise me on a solution to my issue.


Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: How to use both both Funspec and Funsuite (or FunspecLike and FunsuiteLike) Posted: Feb 26, 2015 4:10 PM
Reply to this message Reply
I answered this one in:

https://groups.google.com/forum/#!topic/scalatest-users/dj-x0tCyQVk

Bill

Flat View: This topic has 1 reply on 1 page
Topic: Beginner Scala developer, first post, saying hi Previous Topic   Next Topic Topic: Suites Completed Count Off By 1

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use