https://github.com/oneteme/assertapi-core
AssertApi
https://github.com/oneteme/assertapi-core
assertapi continuous-testing enedis jarvis java json migration performance-testing regression-testing rest-api teme test testing testing-framework usf xml
Last synced: about 1 month ago
JSON representation
AssertApi
- Host: GitHub
- URL: https://github.com/oneteme/assertapi-core
- Owner: oneteme
- License: apache-2.0
- Created: 2022-08-22T21:31:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-27T07:33:54.000Z (over 2 years ago)
- Last Synced: 2023-09-27T17:29:40.669Z (over 2 years ago)
- Topics: assertapi, continuous-testing, enedis, jarvis, java, json, migration, performance-testing, regression-testing, rest-api, teme, test, testing, testing-framework, usf, xml
- Language: Java
- Homepage:
- Size: 2.69 MB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# assertapi-core
AssertAPI is a Java library designed for testing RESTful APIs. It allows developers to easily write and automate tests, while also enabling collaboration with QA teams.
### Features
Here are some of the key features of AssertAPI:
- Tests can be defined in JSON format, making it easy to write and maintain test cases.
- Supports testing of APIs using different authentication methods, such as BASIC and BEARER.
- Can compare API responses in different formats, including JSON, XML, TXT, CSV, and more.
- Supports testing of API migrations between different versions.
- Developers can extend AssertAPI's functionality by injecting their own classes for authentication, comparison, and response transformation.
- Tests can be executed automatically before each deployment to production.
- AssertAPI promotes collaboration between developers and QA teams.
...
## Status
[](https://github.com/oneteme/assertapi-core/actions/workflows/main.yml)
[](https://sonarcloud.io/summary/new_code?id=oneteme_assertapi-core)
## Problem
text..

## Solution
text..

## Integration
text..

## Usecase
text..

## Overview
text..

## Setup
text..

## Deploy
text..

## Assertion
text..

## Architecture
text..

### Extensibility
Developers can extend the functionality of AssertAPI by injecting their own classes to override authentication, comparison, and transformation of responses before comparison. This makes AssertAPI highly customizable and flexible to fit your specific needs.
## MAVEN Integration
```xml
io.github.oneteme.assertapi
assertapi-core
0.0.1-SNAPSHOT
```
## Usage
```java
var assertion = new ApiAssertionFactory()
.comparing(stableRelease, latestRelease) //run api on stable and latest server
.using(responseComparator) // ResponseComparator by default
.build()
.assertApi(api); // compare results each other
```
### Handle assertion result
```java
var assertion = new ApiAssertionFactory()
.comparing(stableRelease, latestRelease)
.using(responseComparator)
.trace((api, res)-> log.debug("testing : {} => {}", api, res)) //log api compare result
.build()
.assertApi(api);
```
### Register custom Client Authenticator
```java
var assertion = new ApiAssertionFactory()
.regiter("BASIC_TOKEN", customTokenAuthenticator) // customTokenAuthenticator must implements ClientAuthenticator
.comparing(stableRelease, latestRelease)
.using(responseComparator)
.build()
.assertApi(api);
```
### Comparison Stages
1. ELAPSED_TIME
2. HTTP_CODE
3. CONTENT_TYPE
4. HEADER_CONTENT
5. RESPONSE_CONTENT
### ApiRequest
| Field | Description | default |
| ---------------- | ----------------------- | ------- |
| uri | HTTP uri | |
| method | HTTP method | GET |
| headers | HTTP headers | N/A |
| body | HTTP body | N/A |
| acceptableStatus | HTTP expected status | [200] |
| name | API name | N/A |
| version | API version | N/A |
| description | API description | N/A |
| contentComparator | Content comparator | N/A |
| executionConfig | Execution configuration | N/A |
### ContentComparator
| Field | Description | default |
| ---------------- | ----------------------- | ------- |
| type | Content comparator type | N/A |
| transformers | Content transformers | N/A |
### ExecutionConfig
| Field | Description | default |
| ---------------- | ----------------------- | ------- |
| parallel | API Parallel execution | true |
| enabled | API Assertion enabled | true |