Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug play framework 2.1.0 scala tests in intellij

i try to debug some tests with intellij.

I have configurated the remote debug as explain in : How to make the debugging in playframework in IntelliJ Idea

And can debug controllers and stuff. When I try to debug tests such as explain in: Is it possible to debug Play! tests from IntelliJ, with a moduled that is located in a sub-folder?

But i recibe the next message:

Action not found

For request 'GET /@tests'
These routes have been tried, in this order:
1GET/controllers.Application.index
2GET/assets/$file<.+>controllers.Assets.at(path:String = "/public", file:String)
3GET/api/crawl/task/begincontrollers.services.crawler.CrawlingService.begin
4GET/api/crawl/task/silk

Any idea what happen here? I'm runing the server in debug mode and run play test, only run the test in console mode. Not as server.

like image 512
vmariano Avatar asked May 24 '13 12:05

vmariano


1 Answers

By default, SBT is forking a new process to execute tests. Your IDE is connected to the SBT main process but not to the "forked" one, that's why debugging doesn't work.

You can override this by defining the following setting in your Build.scala file :

val main = play.Project(appName, appVersion, appDependencies).settings(
  sbt.Keys.fork in Test := false
)

Now, the main process will be used to execute the tests (when executing test from the play console) and your IDE should be able to correctly debug them.

like image 138
mguillermin Avatar answered Oct 09 '22 15:10

mguillermin