How to debug integration test in IntelliJ?

前端 未结 1 643
悲哀的现实
悲哀的现实 2021-02-20 13:41

I have created run configuration in Maven Projects for

mvn -Dit.test=PredictionWorkflowTest verify

which looks like here

<

1条回答
  •  星月不相逢
    2021-02-20 14:37

    Step 1: Add debug to maven run configuration

    You are probably using Maven Failsafe Plugin to run the tests as explained in their documentation

    If that's the case you need to add -Dmaven.failsafe.debug (documentation here) to your maven configuration so it becomes

    mvn -Dit.test=PredictionWorkflowTest verify -Dmaven.failsafe.debug.

    When you run this maven command, the debugger will be listening at port 5005 by default

    Step 2: Configure remote debugger in IntelliJ

    Now in IntelliJ you need to configure a remote debugger configuration on localhost and port 5005

    Remote debugger configuration for integration tests

    Step 3: Debug your app

    Finally, run the maven command. Just before testing it will stop and wait for the debugger to start running the tests. The following message will be displayed in the terminal

    Listening for transport dt_socket at address: 5005

    Then start remote debugger configured in step 2. This should allow you to debug your app on integration tests break-points.

    0 讨论(0)
提交回复
热议问题