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.
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.
...
text..
text..
text..
text..
text..
text..
text..
text..
text..
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.
<dependency>
<groupId>io.github.oneteme.assertapi</groupId>
<artifactId>assertapi-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
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
var assertion = new ApiAssertionFactory()
.comparing(stableRelease, latestRelease)
.using(responseComparator)
.trace((api, res)-> log.debug("testing : {} => {}", api, res)) //log api compare result
.build()
.assertApi(api);
var assertion = new ApiAssertionFactory()
.regiter("BASIC_TOKEN", customTokenAuthenticator) // customTokenAuthenticator must implements ClientAuthenticator
.comparing(stableRelease, latestRelease)
.using(responseComparator)
.build()
.assertApi(api);
- ELAPSED_TIME
- HTTP_CODE
- CONTENT_TYPE
- HEADER_CONTENT
- RESPONSE_CONTENT
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 |
Field | Description | default |
---|---|---|
type | Content comparator type | N/A |
transformers | Content transformers | N/A |
Field | Description | default |
---|---|---|
parallel | API Parallel execution | true |
enabled | API Assertion enabled | true |