Skip to content

karatelabs/karate-examples

Repository files navigation

Karate Examples

Important

Please note that Karate 1.4.1 will not work if your Java version is 22 or greater. Try to remain on a lower version of Java or upgrade your Karate version to 1.5.X

  • karate-template - use this GitHub template if you are looking for a quick-start "skeleton" Karate project for API testing
  • karate-todo - great for training or demo-ing all capabilities of Karate. It includes an app that has a working front-end UI and back-end API. Examples of API tests, API performance tests, API mocks and Web-Browser automation are included.

API Testing

  • karate-demo - This is not designed to be a stand-alone project, and is more of a regression test-suite for Karate itself. But it has a lot of examples of how to use Karate for API testing
  • karate-todo - includes a working API and examples
  • spring-boot - Examples of how to test Spring Boot applications
  • folio-integration-tests - This is a complex external open-source project that uses Karate, and all the tests and project-structure can be viewed. This one is a good example: permissions.feature

API Performance Testing

API Mocks

Web Browser Automation

Windows Desktop Automation

Integrations

This repository also contains examples of how to use Karate and demonstrates integrations with 3rd party tools and frameworks.

  • Accessibility / Axe - Using a JS library to run checks on the DOM in a UI test is very easy
  • ActiveMQ / Async - besides the demo example, refer to this diagram & example for generic async flows using Java interop
  • Allure - Official support for Allure Report
  • AWS - Any AWS service can be integrated using the AWS Java SDK and Java Interop.
  • Broadcom / CA - Broadcom Continuous Delivery Director has a plug-in for Karate integration
  • BrowserStack - How to configure Karate to run tests on BrowserStack
  • CLI / Bash - How to use Karate to test the command-line or use shell scripts
  • Database - Include SQL / database calls into functional (and even performance) test suites
  • Docker - Easily inject Karate into CI / CD pipelines using Docker
  • GitHub Codespaces - open a GitHub project directly in a browser and run and edit Karate tests
  • gRPC - seamlessly test gRPC services with Karate
  • Gatling - Karate can re-use API functional tests as performance tests !
  • Gradle - Karate has very good support for Gradle
  • Jacoco - use Jacoco for code-coverage
  • JBang - using only JBang to run Karate tests and even manage custom Java code and classpath libraries without installing Java
  • JUnit - There is also a pure Java API to run tests from any Java unit-testing framework such as TestNG
  • Kafka - seamlessly test Kafka and async flows
  • Lambdatest - How to configure Karate to run tests on Lambdatest
  • Maven - Karate has excellent support for Maven, most of the examples here are Maven projects
  • Micronaut - Karate is great for testing Micronaut applications
  • NPM - there is an option to install Karate as a NPM package and use it from Node / JS
  • Quarkus - Karate is a good fit for integration testing Quarkus applications
  • RabbitMQ - Using Java to send and receive messages with RabbitMQ
  • ReportPortal official integration agent from ReportPortal.
  • Sauce Labs - How to configure Karate to run tests on Sauce Labs
  • Slack - Refer to blog posts and sample code from the community
  • Spring Boot - Resources on testing Spring Boot applications with Karate
  • SSH - how to open an SSH connection and invoke server commands using Karate
  • WebSocket - Built-in support for WebSocket or you can use Java interop for very advanced scenarios
  • Xray - Official documentation from the Xray team on how to integrate Karate