1

I am new to Maven (and karate), and I'm evaluating tools for our API testing needs (the rest of the team is experienced on Maven, though).

I've done my research on karate and all I can find are tutorials on how to create a new project and use karate on this new project.

I am looking for a tutorial on how to integrate karate into an existing project (for dummies). Does something like this exist?

Daniel
  • 770
  • 3
  • 8
  • 21

1 Answers1

1

It should be quite easy actually, just add the maven dependencies needed to your existing project. If you run into errors, you can just follow this process (with the offending pom.xml included) so that we can help: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

May I suggest that you start out using the stand-alone executable JAR: https://github.com/intuit/karate/tree/master/karate-netty#standalone-jar

The idea here is you can quickly get up and running without knowing anything about Java and the only pre-requisite is the JRE (not the full-blown JDK). And you may actually be able to integrate this into your existing build by simply invoking via the command-line. And Visual Studio Code would be sufficient as an editor.

Refer to this tutorial / review by someone who's actually more of a Python dev: https://automationpanda.com/2018/12/10/testing-web-services-with-karate/

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • 1
    Thanks, @Peter. I understand that adding the dependencies is only the first step. Since I am a complete newbie on Maven, I'd suggest a tutorial teaching: 1. how to add the dependencies / 2. how to write the first .feature file / 3. where to put the first .feature file / 4. how to configure Eclipse / 5. how to run my first .feature file. I feel I'm getting there, but the trial and error path is frustrating... – Daniel Feb 20 '19 at 20:49
  • @Daniel since you mention things like "where to put the first `.feature` file, I still don't understand why the quickstart doesn't work for you: https://github.com/intuit/karate#quickstart - but anyway I am trying to find time to create tutorials. – Peter Thomas Feb 21 '19 at 02:43
  • Trying the quickstart path. Just created a new maven project using the archetype in Eclipe. Didn't touch anything. When I use "Run as Cucumber Feature" on the users.feature file, I get a bunch of javascript errors like "11:40:48.727 [main] ERROR com.intuit.karate - javascript function call failed: ReferenceError: "karate" is not defined". At least it's more than what I was gettign when trying to integrate karate on my existing project ;) – Daniel Feb 21 '19 at 16:40
  • 1
    @Daniel pretty sure your Java version is the problem, either it should be 1.8.0_112 or greater, or please refer this: https://stackoverflow.com/a/54554226/143475 – Peter Thomas Feb 21 '19 at 16:51
  • 1
    yes, I can run the quickstart project after updating my Java version! Thanks! – Daniel Feb 25 '19 at 16:12