Karate: Correct way of Setting up the project in eclipse

If you are new to Karate DSL, please follow this link to know about it.

When I started working with Karate framework, I struggled a lot to figure out various things that involves setting up the project, installing plugins, writing various json path , regex for matching etc

While starting I faced few common problems which I want to mention here so that it will save time and get it started quickly without to waste much of time. Even though every details is mentioned in official page, it still lacks few common steps that is not covered.

  • Create a Maven project and add below Dependencies
<dependency>
    <groupId>com.intuit.karate</groupId>
    <artifactId>karate-apache</artifactId>
    <version>0.9.4</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>com.intuit.karate</groupId>
    <artifactId>karate-junit4</artifactId>
    <version>0.9.4</version>
    <scope>test</scope>
</dependency>
  • Now Add cucumber Plugin from Eclipse market place
    This is where the trick is.
    You need to install the correct cucumber plugin here , else it will give errors in feature file syntax.
  • Add the plugin by using the below link from install software option or visit the url and drag and drop install button to eclipse
    https://marketplace.eclipse.org/content/cucumber-eclipse-plugin
    Note: Do not install Natural plugin , it may not work.
  • After installing make sure to configure the User settings for cucumber in eclipse
    To do so, go to preferences –> Search for user settings in Cucumber option and enter “com.intuit.karate” in root package name.
  • Once this is done, create a feature file and start writing Scenarios .

Note: If you are working under corporate proxy, make sure to add below Proxy configuration in Feature file :
Background:
* configure proxy = ‘http://proxy.com:portnumber/’

Hope this helps.
Comment your problems .
I will try to answer your queries.

Leave a Reply