-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Debug Server
Karate has first-class debug support based on the Debug Adapter Protocol (DAP) standard. The Karate Labs Pro IDE plugins take care of starting a debug session automatically and passing the details of feature files and break-points to the debug server.
The karate-debugserver artifact is available via Maven or Gradle.
All runtime approaches documented below (except VS Code bundled) require this extra dependency on the classpath.
Here is the snippet you need for Maven:
<dependency>
<groupId>io.karatelabs</groupId>
<artifactId>karate-debugserver</artifactId>
<version>{karate.debugserver.version}</version>
<scope>test</scope>
</dependency>
With the above extra dependency in place for a Maven or Gradle project, you can debug a Karate test if you are on the Karate Labs Pro version of the IntelliJ plugin.
Using the debug server in VS Code depends on how you are using Karate.
If using the bundled Karate runtime in the Pro version of the Karate Labs extension, debugging of feature files should work without any extra setup.
If you are using a version of Karate that is 1.4.1 or greater, you should add the karate-debugserver JAR to the custom classpath. You can download the latest JAR from here.
If you are on the Karate Labs Pro version of the VS Code extension switching the "Run Mode" to Maven should be sufficient to be able to debug a Karate feature file from the Debug
codelens.
If using VS Code and Gradle, you can define a task to do this:
task karateDebug(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
main = 'com.intuit.karate.Main'
}
And then you can use the "Run Mode Custom" to hook up debugging from VS Code.