Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xurten/karate_practice
This repository contains example test scenarios using Karate DSL for API testing.
https://github.com/xurten/karate_practice
api-testing karate-framework
Last synced: 13 days ago
JSON representation
This repository contains example test scenarios using Karate DSL for API testing.
- Host: GitHub
- URL: https://github.com/xurten/karate_practice
- Owner: xurten
- Created: 2023-03-06T17:20:49.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-12T17:13:16.000Z (almost 2 years ago)
- Last Synced: 2024-11-23T11:16:13.462Z (2 months ago)
- Topics: api-testing, karate-framework
- Language: Gherkin
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Karate practice
This repository contains example test scenarios using Karate DSL for API testing. Repository contains tests for GET, POST, PUT, DELETE actions.
(Java, Javascript, Json, API, Cucumber, BDD, eclipse)# Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.# Prerequisites
- Java 8 or higher
- Maven# Installing
Clone the repository:
```
git clone https://github.com/xurten/karate_practice.git
```**Example scenario for delete action:**
```
Scenario: Delete a user with the given user id
# 1. Create a user with POST CALL
Given path '/public/v2/users'
And request request_payload
And header Authorization = 'Bearer '+ token_id
When method POST
Then status 201
And match $.id == '#present'
And match $.name == '#present'
* print response# Fetch the user id
* def user_id = $.id
* print user_id
# 2. Delete the same user
Given path '/public/v2/users/' + user_id
And header Authorization = 'Bearer '+ token_id
When method DELETE
Then status 204# 3. Get the same user with the same user id
Given url base_url + '/public/v2/users/' + user_id
When method GET
Then status 404
And match $.message == 'Resource not found'
```# Running the Tests
You can run the tests from the command line by running the following command from the root of the project:
```
mvn clean test
```
**All features are under src/test/java/features**