Coder Social home page Coder Social logo

qake-karate-api-tests's Introduction

@karatelabs/karate

Seamlessly use the power of Karate from Node / JS projects.

Usage

Given this script test.js:

#! /usr/bin/env node
const karate = require('@karatelabs/karate');
karate.exec();

And in package.json (use the latest version from npm):

{
  "scripts": {
    "test": "node test.js"
  },
  "devDependencies": {
    "@karatelabs/karate": "^0.2.2"
  }
}

When you run npm install, jbang and other Karate dependencies needed will be installed via jbang-npm.

And to run a single test:

npm run test karate/httpbin.feature

Or to run all tests in a folder:

npm run test karate

Known Issues

Users on Windows have reported issues such as the npm install failing to complete and without any errors shown.

Please do contribute if you can and improve how JavaScript projects can integrate smoothly with Java projects !

As a workaround, please install JBang manually and re-try the npm install step.

Setting Karate Version

To use a specific version of Karate, just set karate.version before calling karate.exec():

#! /usr/bin/env node
const karate = require('@karatelabs/karate');
karate.version = '1.2.0';
karate.exec();

CLI Reference

All Karate capabilities can be invoked by the command-line.

The most common needs are to:

  • run feature-file(s) or all feature-files in a folder as Karate tests
  • start an API mock-server

The complete documentation can be found here.

You can also use the --help command-line option to see all the possible options and brief descriptions on the console.

karate-config.js

Karate will look for a karate-config.js file in the current working directory.

But if you need to point to a different directory, you can set karate.config.dir before calling karate.exec()

#! /usr/bin/env node
const karate = require('@karatelabs/karate');
karate.config.dir = '/users/myname/some/dir';
karate.exec();

qake-karate-api-tests's People

Watchers

Paul Eipper avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.