Karate is the only open-source tool to combine API test-automation, mocks and performance-testing into a single, unified framework. The BDD syntax popularized by Cucumber is language-neutral, and easy for even non-programmers. Besides powerful JSON & XML assertions, you can run tests in parallel for speed - which is critical for HTTP API testing.
You can easily build (or re-use) complex request payloads, and dynamically construct more requests from response data. The payload and schema validation engine can perform a 'smart compare' (deep-equals) of two JSON or XML documents, and you can even ignore dynamic values where needed.
Test execution and report generation feels like any standard Java project. But there's also a stand-alone executable for teams not comfortable with Java. Just write tests in a simple, readable syntax - carefully designed for HTTP, JSON, GraphQL and XML.
Visit the karate github repo fore more information.
The examples in this repository are setup to run with the stand-alone executable, in VS Code or in IntelliJ.
Spin up your test environment in local environment or a test environment of your choice.
- Follow these instructions to download and "install" the stand-alone executable to a local directory of your choice
- Pull the tests in this repository to your local machine
- Update
karate-config.js
file for your project with the environment you wish to test againstTODO: Currently just override the value in the IF statement... need to figure out how to set MAVEN environment variables
- Run a test with
java -jar /your/path/to/karate-x.x.x.jar /your/path/to/*.feature
- Install the Karate Runner extension
- This project needs to be imported into IntelliJ using the
maven
archetype - Copy and update the file
config-dev.yaml
asconfig-staging.yaml
if you want to run tests against an environment named staging Detailed instructions are available here
- Copy and update the file
config-dev.yaml
asconfig-staging.yaml
if you want to run tests against an environment named staging - Run the test using
mvn test -DargLine="-Dkarate.env=dev"
Detailed instructions are available here