I am setting up a project using Play 2 and I am already able to debug the webapp using eclipse remote debugging. Though, I'd also like to use breakpoints along my tests. Does anyone know how setup unit tests' remote debugging?
相关问题
- Dependencies while implementing Mocking in Junit4
- Eclipse and Mylyn : how to disable grey files in t
- PlayFramework: how to transform each element of a
- Installing Pydev for Eclipse throws error
- Error in Scala Compiler: java.lang.AssertionError:
相关文章
- selenium+eclipse 打开网页时报错
- Eclipse failing to open
- Setup and Tear Down of Complex Database State With
- Eclipse how can I indent C++ preprocessor macros
- Why is FindBugs ignoring my check for null?
- how to set H2 primary key id to auto_increment?
- Eclipse cleanup - what are the “.index” files - ca
- Eclipse plugin to find out unused methods in a cla
This is happening since Play (SBT) forks separate JVM for tests, without options needed for remote debug. You have at least two options: disable fork of new JVM, pass additional options to JVM used for tests.
To disable fork, modify Build.scala, add
fork in (Test) := false
, see full Build.scala example below:To pass additional options, add you can use this code:
You will need to configure your IDE to use port 9998 to attach to tests. Also, you will need to re-attach debugger each time when you run tests, that could be inconvenient.
By disabling fork and parallel executing in Test environment, You can debug tests. Only you should add these lines end of Your
build.sbt
file:i use eclipse or rather scala ide
instead of running "play" i run this command "play debug" then play would print this message:
the normal $ prompt for play would appear. then enter this command "run"
from eclipse, i set the breakpoint and click "Run -> Debug Configurations..." look for "Remote Java Application" on the left and click "Launch New Configuration" (small icon, top left, looks like a 'new document' icon). the default port would be 8000, change it to 9999 and change the machine, most probably you would be using localhost. and click on the [Debug] button
that should do it. just load the normal
http://localhost:9000
on your browser just wait for the application to hit the breakpoint.