Share Server or App With All Tests?

8 views
Skip to first unread message

Dixon

unread,
Jun 3, 2016, 11:52:07 AM6/3/16
to scalatest-users
Hello,

For performance reasons, I would like all of my functional tests to share the same FakeApplication or TestServer. Naively I created an "object TestServer" that housed this singleton instance. But I noticed that every test class that runs gets a brand new instance of "object TestServer".

I have been looking at the docs. The combination of "AppPerSuite" and "ConfiguredApp" looked promising, but in practice did not work and was a bit messy to implement. So a couple of questions really?

1. How does ScalaTest run for it to reset the state of all objects? Does it fork a new Jvm process for each test file or something? I'm almost certain it doesn't do that, but I'd love to know what it does do?

2. Are there any other ways to share a single instance or some global state between tests?

Thanks

Dixon

unread,
Jun 3, 2016, 11:53:34 AM6/3/16
to scalatest-users
Sorry, I should have mentioned I was referring to Functional Tests with Play Framework 2.3
Reply all
Reply to author
Forward
0 new messages