Scalatest: when AsyncTestSuite is used it reports Empty test suite

Created on 19 Oct 2016  Â·  4Comments  Â·  Source: scalatest/scalatest

Hi, Whenever i bring in AsyncTestSuite or AsyncWordSpec into scope the test results always report Empty Test Suite from IDEA, am i doing something wrong?

class HotelServiceRouteGetTest extends WordSpec with AsyncTestSuite with Matchers with ScalatestRouteTest with MockFactory {

  val gE = A(7.11010101, 23.3939393)
  val hE = H(1, "hotel", geoEntity, 1, 1)
  val hS = stub[HS]
  (hS.getByHotelById _).when(1).returns(Future.successful(Option(hotelEntity)))
  (hS.saveHotel _).when(H(1, "My hotel", A(7.1010101, 23.3939393), 1, 1)).returns(Future.successful(Option(hotelEntity)))
  val smallRoute = new HSR(hS)

  "calling GET hotels/2 should return json" in {
    Get("/hotels/1") ~> smallRoute.route ~> check {
      responseAs[String] shouldEqual "{\"id\":1,\"name\":\"My hotel\",\"geo\":{\"latitude\":7.11010101,\"longitude\":23.3939393},\"cityId\":1,\"recStatus\":1}"
    }
  }

  "calling GET hotels/1 should return json" in {
    Get("/hotels/1") ~> smallRoute.route ~> check {
      responseAs[String] shouldEqual "{\"id\":1,\"name\":\"My hotel\",\"geo\":{\"latitude\":7.11010101,\"longitude\":23.3939393},\"cityId\":1,\"recStatus\":1}"
    }
  }
}

Most helpful comment

You should extends AsyncWordSpec and AsyncMockFactory instead.

All 4 comments

I have this same issue but wasn't even able to identify what was causing it. I am going to try removing the MockFactory mixin to see what happens.

HI Nayana,

I think you should just use AsyncWordSpec:

class Hotel extends AsyncWordSpec with Matchers ...

Hope this helps.

Best Regards,
Chee Seng

On Sun, Nov 13, 2016 at 12:40 AM, David Stancu [email protected]
wrote:

I have this same issue but wasn't even able to identify what was causing
it. I am going to try removing the MockFactory mixin to see what happens.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/scalatest/scalatest/issues/991#issuecomment-260132700,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABQsGXT56uezlfbNCz39i3p7mpJVSzcuks5q9ev_gaJpZM4Ka4pa
.

@cheeseng ok i will try, i solved the original issue i had and wanting to use async because the fixture was causing all the 2+ tests to fail. i solved my issue by moving fixture inside a function to have it always return a new instance of fixture for each test

You should extends AsyncWordSpec and AsyncMockFactory instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TomasMikula picture TomasMikula  Â·  3Comments

raimohanska picture raimohanska  Â·  5Comments

japgolly picture japgolly  Â·  5Comments

cheeseng picture cheeseng  Â·  5Comments

djneades picture djneades  Â·  5Comments