DEV Community

Cover image for How to work with Karate Config.js to Switch Env in Karate API Testing Automation?
Pramod Dutta
Pramod Dutta

Posted on

How to work with Karate Config.js to Switch Env in Karate API Testing Automation?

In this tutorial, We are going to learn about the Karate Configuration, We will work with the Karate config.js and try to switch the variables based on the staging and production environment.

✅ What is Karate Configuration?

Karate expects a file called karate-config.js to exist in the class path and contains a function JavaScript.
This function is expected to return the JSON object, and that all keys and values for that JSON object will be available as script variables. Below function calls a feature file Authenticate.

✅ Source - https://github.com/intuit/karate/

In this video, We are going to learn How to Test GraphQL Query using Karate API, This is part of Karate API Testing tutorial series.

✅ Download Source Code - https://sdet.live/karatecode
✅ Download Notes(PPT) - https://sdet.live/karate-ppt
✅ Official Website for Learning Karate API Framework - https://github.com/intuit/karate

✅ What is Karate API?

Karate is an open-source API test automation tool. API tests are written using Behavior Driven Development (BDD) Gherkin syntax

✅ We will learn difference between Karate vs Rest-assured.
Download the Doc. - https://sdet.live/karate-vs-restassured

✅ What is Karate Framework?

In this Karate Framework Tutorial, We are going to create the Own Karate API Testing Automation Framework, We will use the Person APIs(with JSON Server).

After that We will automate APIs of GitHub Repo V3.

There are multiple Karate API testing examples we are going to show you in this series.

✅ Why we Need Karate API Testing?

  • Open source
  • API Testing, Mocking,
  • Performance Testing,
  • UI Automation, Reporting
  • Parallel Execution
  • BDD Style, Native JSON/XML support.
  • Readable syntax.
  • Mix API and UI test-automation

Top comments (0)