Integration Tests
To make sure that your SDK works in production, Fern will auto-generate integration tests that run before release. The release will only take place if no tests fail.
What gets generated?
Mock Server
Fern will use your API Definition to generate a mock server that will be used in the integration tests. The mock server will assert that the SDK is making the correct requests.
By default, the mock server will use the examples specified in your API Definition. If no examples are specified, Fern will generate examples to the best of its ability.
Specifying examples in your API Definition is recommended to ensure so that you can control what data is used in the tests.
Integration Tests
Fern will generate integration tests as part of your SDK. These integration tests will run against the mock server and assert validity of requests and responses.
The generated tests will use appropriate testing framework for the language:
- Jest for JavaScript/TypeScript
- Pytest for Python
- JUnit for Java
- RSpec for Ruby
- NUnit for C#
- The standard library for Go
GitHub Wofklows
Fern will generate a GitHub workflow that will run the integration tests on every pull request, commit and release.
Adding additional tests
If you would like to add additional tests, you can do so by committing them
directly to the generated SDK repositories. Note that you will need to
add the test files to your .fernignore
file to prevent them from being
overwritten by Fern.