如何在IntelliJ中调试Play Framework 2.1.0 Scala测试 [英] How to debug play framework 2.1.0 scala tests in intellij

查看:77
本文介绍了如何在IntelliJ中调试Play Framework 2.1.0 Scala测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用intellij调试一些测试.

i try to debug some tests with intellij.

我已按照以下说明中的说明配置了远程调试:如何在IntelliJ Idea中的Playframework中进行调试

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

并且可以调试控制器和其他东西.当我尝试调试测试时,例如: 是吗可以调试Play!来自IntelliJ的测试,带有位于子文件夹中的模块?

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.

推荐答案

默认情况下,SBT分叉一个新进程来执行测试.您的IDE已连接到SBT主进程,但未连接到分叉"主进程,这就是为什么调试不起作用的原因.

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.

您可以通过在Build.scala文件中定义以下设置来覆盖此设置:

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
)

现在,主要过程将用于执行测试(从播放控制台执行test时),并且您的IDE应该能够正确调试它们.

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.

这篇关于如何在IntelliJ中调试Play Framework 2.1.0 Scala测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆