I understand the philosophy behind Karate is to not have to add custom Step definitions. However, the REST API Testing we perform in our project is more integrated so we have to verify POST responses in MongoDB collections, ActiveMQ, and a SQL Server DB. Is there anyway to easily add custom step definitions to expand the Karate DSL Framework beyond its REST Capabilities? I tried downloading the source code and importing it as a Maven project but I came across many dependency issues.

1

There are 1 best solutions below

0
On BEST ANSWER

It is very easy to extend Karate via Java Interop. The best way to understand this, is to look at this demo example which uses JDBC to call a database: dogs.feature.

It is worth calling out here that if you return a Map (or List of Maps) from Java - you are back in JSON-land within Karate, and you can use match and all the other data-driven goodness of Karate.

Yes, it is that easy - and you don't have the un-necessary overhead of Step Definitions and dependency injection.

Hope this makes it clear as to why you don't need step definitions at all !