How to debug play framework 2.1.0 scala tests in intellij

别来无恙 提交于 2019-12-06 02:56:27

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/16734920/how-to-debug-play-framework-2-1-0-scala-tests-in-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!