I'm trying to debug my unit tests with Eclipse (Kepler), in a Play! project. I launched play debug. In Eclipse, I created a Remote Java Application in Debug Configurations with the port supplied by the output of the command line. Clicked Apply, then Debug, added breakpoints. In the command prompt of my Play project, I launched test. Eclipse never stops at the breakpoints. It's very annoying. I'm on Windows 7 Pro 64bits.
Thanks for your help
To debug, start your application with activator -jvm-debug 9999 run and in Eclipse right-click on the project and select Debug As, Debug Configurations. In the Debug Configurations dialog, right-click on Remote Java Application and select New. Change Port to 9999 and click Apply.
To debug your application, select a Java file with a main method. Right-click on it and select Debug As Java Application. If you started an application once via the context menu, you can use the created launch configuration again via the Debug button in the Eclipse toolbar.
Add:
val main = play.Project(appName, appVersion, appDependencies).settings(
// Add your own project settings here
Keys.fork in (Test) := false
)
in your Build.scala as explained here
With command line in your Play! project:
I just test it in Keppler, works fine for me ;)
Building on @Pierre-Yves' suggestion (I'm new to Play 2.2 and SBT, so this may be avoidable), to debug individual unit tests via IntelliJ I needed the following in build.sbt (thanks to Mike Slinn):
Keys.fork in Test := false
parallelExecution in Test := false
Without the build.sbt changes, executing the following in the Play debug console (each session) worked:
$ set sbt.Keys.fork in Test := false
After either of those solutions, I could then set breakpoints and remote debug individual test classes via:
$ test-only *package.class*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With