Testing

Fern provides comprehensive testing for your SDKs through generated and handwritten tests.

Generated tests

Pro and Enterprise feature

This feature is available only for the Pro and Enterprise plans. To get started, reach out to support@buildwithfern.com.

Fern auto-generates tests that must pass before SDK release. Fern generates a GitHub workflow in each SDK repository that runs unit tests and any enabled mock server tests on every pull request, commit, and release.

Unit tests

Fern generates unit tests for all SDK languages. They verify individual methods in isolation without making network calls.

Mock server tests

Mock server (wire) tests run your SDK against a mock server generated from your API definition. They verify that the SDK sends HTTP requests and receives HTTP responses as expected. These tests are generated for all endpoints in a service.

Mock server tests are available for TypeScript, Go, and Java. Configure mock server tests in your generators.yml:

LanguageConfigurationDefault
TypeScriptgenerateWireTeststrue
GoenableWireTestsfalse
Javaenable-wire-testsfalse

Integration tests

Enterprise feature

This feature is available only for the Enterprise plan. To get started, reach out to support@buildwithfern.com.

Handwritten integration tests run against your real API server to test end-to-end functionality with live data.

Adding additional tests

You can add custom tests directly to your SDK repositories. Include test files in your .fernignore file to prevent overwrites during regeneration.