Debugging in-game tests

I'm having problems trying to debug a test that doesn’t work on Play.

At first I couldn’t get him to get to the breakpoint, which, as it turned out, was caused by the deployment of a new JVM, which occurs during testing, so I found out what I need to add:

javaOptions in Test ++= Seq(
    "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9998"
)

to file build.sbt.

Now it hits the breakpoint when I run the debugger (I use IntelliJ), but the problem is that it will not let me start the debugger before it starts the tests.

If I use play debug, then playback will start and the socket will open (9999), and then I can start the debugger, and only then in the playback console will it launch my application (using run), but I can not do the same with the tests.
When I use play test, tests will start, so I have to start the debugger after running the tests.

Is there any way around this?
Thank!

+4
source share
1 answer

This is how I do it, which I hope will help others.

Modify build.sbt or build.scala to remove the default option for markup for each test. Add the line Keys.fork in (Test): = false

val main = play.Project(appName, appVersion, appDependencies).settings(
  resolvers += Resolver.sonatypeRepo("snapshots"),
    resolvers += Resolver.sonatypeRepo("releases"),
    Keys.fork in (Test) := false
)

( ) , .

'JAVA_HOME=`/usr/libexec/java_home -v 1.7`; JAVA_OPTS="-Xms1g -Xloggc:gc.log -verbose:gc -XX:+PrintGCDateStamps -server -Xmx2g -Dhttps.port=9443" activator -jvm-debug 9999'

, . intelliJ

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999

localhost 9999

, , - . , , .

+4

Source: https://habr.com/ru/post/1538746/


All Articles