Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/leidenheit/itarazzo-library

Bring automated API testing to life with openapi and arazzo
https://github.com/leidenheit/itarazzo-library

api-rest arazzo arazzo-specification openapi openapi-specification testing

Last synced: 19 days ago
JSON representation

Bring automated API testing to life with openapi and arazzo

Awesome Lists containing this project

README

        

# Itarazzo Library
Enables seamless execution of OpenAPI Initiative (OAI) [Arazzo Specifications](https://spec.openapis.org/arazzo/latest.html) in an integration testing
context. Designed for developers who need automated and test-driven verification of API workflows, *Itarazzo Library*
extends integration testing capabilities using a range of powerful technologies.

---
>**Note**: This project is developed in my free time alongside family and full-time work. Any feedback or contributions are greatly appreciated as I strive to make this tool as helpful as possible for other developers.
---

## Key Features
- **Arazzo Specification Integration**: Executes Arazzo Specifications within integration tests, allowing automated testing
of complex workflows based on [OpenAPI definitions](https://spec.openapis.org/oas/v3.1.1.html).
- **End-to-End API Testing**: Facilitates comprehensive testing with support for request validation, response parsing, and
detailed logging.
---

## Technologies Used
Itarazzo Library leverages a robust stack of technologies to provide extensive API testing support:
- **JUnit 5**: For structuring and running integration tests.
- **Jackson**: For efficient JSON parsing and serialization.
- **Everit JSON Path**: Enables flexible, path-based JSON validation.
- **XPath**: Supports XML handling, useful for APIs returning XML responses.
- **RestAssured**: Simplifies HTTP requests and validations for RESTful APIs.
- **Swagger**: Parses OpenAPI specifications, enabling standardized API testing against specifications.
---

## Getting Started
### Prerequisites
Ensure you have the following dependencies in your project’s pom.xml:

```xml


de.leidenheit
itarazzo-library
0.0.1
test




ch.qos.logback
logback-classic
1.5.6


ch.qos.logback
logback-core
1.5.6

```

### Basic Usage
To use Itarazzo Library in your integration tests, start by creating a test class that extends the capabilities of the
library with the JUnit 5 `ItarazzoExtension`.

```java
@ExtendWith(ItarazzoExtension.class)
class ExampleArazzoIT {

@TestFactory
@DisplayName("Workflow")
Stream executeWorkflow(final ArazzoSpecification arazzoSpec, final String inputsFilePath) {
var inputs = InputsReader.readInputs(inputsFilePath);
ItarazzoDynamicTest dynamicTest = new ItarazzoDynamicTest();
return dynamicTest.generateWorkflowTests(arazzoSpec, inputs);
}
}
```

### Configuration Options
#### Environment Variables
To define specific Arazzo files and inputs:

- `ARAZZO_FILE`: Specifies the path to the Arazzo YAML specification file.
- `ARAZZO_INPUTS_FILE`: Path to a valid JSON file containing test inputs.

These can be set directly in the test environment or passed as system properties in Maven.

---
## Custom Extension Points (coming soon)
The Itarazzo Library features extensibility, allowing you to configure and customize API interactions precisely to
match your testing requirements. Below are some common extension points.

### Custom Server Selection
To designate a server specifically for the integration test, use the `x-itarazzo-designated-server` extension.
If no server is designated, the library considers the first server from the OpenAPI Specification (OAS).

Example in the OpenAPI file:
```yaml
servers:
- url: https://api.example.com/v1
x-itarazzo-designated-server: true
```
This configuration ensures that the Itarazzo Library targets the specified server during test execution.

---
## Running Tests
To execute the tests, run the following Maven command:

```bash
mvn verify -Darazzo.file="/path/to/arazzo.yaml" -Darazzo.inputs.file="/path/to/inputs.json"
```
This command triggers the workflow specified in your Arazzo YAML and applies test inputs from the JSON file.

---
### Contributions
Contributions are welcome! If you encounter any issues or have suggestions, please submit them as issues or pull requests.