PHPackages                             spryker-sdk/testify-openapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. spryker-sdk/testify-openapi

ActiveLibrary[Testing &amp; Quality](/categories/testing)

spryker-sdk/testify-openapi
===========================

TestifyOpenApi module

00PHP

Since Nov 30Pushed 1y ago35 watchersCompare

[ Source](https://github.com/spryker/testify-openapi)[ Packagist](https://packagist.org/packages/spryker-sdk/testify-openapi)[ RSS](/packages/spryker-sdk-testify-openapi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

TestifyOpenApi Module
=====================

[](#testifyopenapi-module)

[![Latest Stable Version](https://camo.githubusercontent.com/d79bd51b135252710ed779f7bca08f87cb61043afe060c86a4b752f269128ace/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722f746573746966792d6f70656e6170692f762f737461626c652e737667)](https://packagist.org/packages/spryker/testify-openapi)[![Minimum PHP Version](https://camo.githubusercontent.com/eed4d5cf01364b115489810f47ed4b33191d997e7ab4014f3daff1c09fbae7d9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e332d3838393242462e737667)](https://php.net/)

TestifyOpenAPI provides basic test infrastructure for testing your API schema.

Installation
------------

[](#installation)

```
composer require spryker/testify-openapi --dev

```

Documentation
-------------

[](#documentation)

[Module Documentation](https://academy.spryker.com/developing_with_spryker/module_guide/modules.html)

Integration
===========

[](#integration)

Add the `\Spryker\Glue\TestifyOpenApi\Helper\OpenApiHelper` helper to your codeception.yml then run the build command to get the new methods generated into your tester class.

This Helper offers the following methods:

- `setAccessToken()` you can pass a valid access token to this method which will be used for all requests that are secured.
- `setOpenApi()` this method sets the path to an OpenAPI schema file that will be used to test the API.
- `setDebugPath()` this method can be used when you want to run only one specific path together with the `testAllPaths()` method.
- `testAllPaths()` this method will use the schema file and runs each operation and tries to automatically create valid requests based on your schema definition. It also tries to make tests for all expected responses (not completed feature)
- `testPath()` this method will run exactly one path, can be used for edge cases or tests that can't be set up automatically.
- `testPathWithoutSchemaValidation()` this method will run exactly one path without schema validation, can be used for egde cases that requires invalid requests to be sent.
- `addHook()` this method takes an instance of an `\Spryker\Glue\TestifyOpenApi\Helper\Hook\AbstractHook` see the dedicated section for hooks.

How this tool works
-------------------

[](#how-this-tool-works)

The OpenAPI schema file defines the API with all it's expected request attributes, expected response codes and the expected response bodies. To ensure that the schema files is in line what the code behind that API is doing it reads the necessary informations out of the passed schema file.

Out of the schema file a request is build and validated against the schema file. When this validation passes it will fire the request against the application. The application returns a response code which is validated against the in the schema file defined one.

Working with data
-----------------

[](#working-with-data)

In many cases you need to have data in the database to run tests against e.g. a GET /pets/{petId} requires to have one Pet in your database. You can either set it manually and use a defined URL with your created data or you can use a Hook that reacts to this kind of requests. See the Hooks section in this document.

Working with Security
---------------------

[](#working-with-security)

When the operation in the schema contains a security configuration (only works with Bearer token authorization ATM) this tool will require to add the proper security header.

To get a valid access token you need to add a `AccessTokenHelper` see [https://github.com/spryker-projects/registry-service/blob/master/tests/RegistryTest/Glue/Testify/\_support/Helper/AccessTokenHelper.php](https://github.com/spryker-projects/registry-service/blob/master/tests/RegistryTest/Glue/Testify/_support/Helper/AccessTokenHelper.php) as an example implementation.

You can use what ever you like to use to get a valid access token BUT don't use the Auth0 API to create one for tests as it will cost money for each token.

Using Hooks
-----------

[](#using-hooks)

Hooks are a way to manipulate in many ways the request that is sent against the application. Use the `\Spryker\Glue\TestifyOpenApi\Helper\Hook\AbstractHook` class to build a hook.

The Abstract class extends Codeceptions `\Codeception\Module` which is used to get access to other Helpers and for automatically attaching the current Hook into the OpenApiHelper with the `_beforeSuite()` method.

The Abstract class defines the following methods:

- `accept()` this method is used to decide if the current Hook should be used for the current request.
- `setUp` this method can be used to prepare data in the database or what ever needs to be set up before the request is sent.
- `getPathParameters()` this method can be used when the path contains path placeholder like in `/pets/{petId}`. The former created Pet with the `setUp()` method can save e.g. the id of the created pet and return it in this method so the generated URL will be against the existing database entity.
- `getQueryParameters()` same as for the `getPathParameters()` but it will be used for query parameters e.g. `/pets/{petId}?key=value`.
- `manipulateRequest()` this method can be used to further manipulate the created ServerRequestInterface to e.g. add headers.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 92.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10738957?v=4)[Spryker Bot](/maintainers/spryker-bot)[@spryker-bot](https://github.com/spryker-bot)

---

Top Contributors

[![stereomon](https://avatars.githubusercontent.com/u/1382877?v=4)](https://github.com/stereomon "stereomon (13 commits)")[![spryker-release-bot](https://avatars.githubusercontent.com/u/26904324?v=4)](https://github.com/spryker-release-bot "spryker-release-bot (1 commits)")

### Embed Badge

![Health badge](/badges/spryker-sdk-testify-openapi/health.svg)

```
[![Health](https://phpackages.com/badges/spryker-sdk-testify-openapi/health.svg)](https://phpackages.com/packages/spryker-sdk-testify-openapi)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M678](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M753](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M571](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
