OpenFeature CLI Integration Testing
This directory contains integration tests for validating the OpenFeature CLI generators.
Integration Test Structure
The integration tests use Dagger to create reproducible test environments without needing to install dependencies locally.
Each integration test:
- Builds the CLI from source
- Generates code using a sample manifest file
- Compiles and tests the generated code in a language-specific container
- Reports success or failure
Running Tests
Run all integration tests
make test-integration
Run a specific integration test
# For C# tests
make test-csharp-dagger
Adding a New Integration Test
To add an integration test for a new generator:
- Create a combined implementation and runner file in
test/integration/cmd/<language>/run.go
- Update the main runner in
test/integration/cmd/run.go
to execute your new test
- Add a Makefile target for running your test individually
See the step-by-step guide in new-language.md for detailed instructions.
How It Works
The testing framework uses the following components:
test/integration/integration.go
: Defines the Test
interface and common utilities
test/integration/cmd/run.go
: Runner for all integration tests that executes each language-specific test
test/integration/cmd/<language>/run.go
: Combined implementation and runner for each language
test/<language>-integration/
: Contains language-specific test files (code samples, project files)
Each integration test uses Dagger to:
- Build the CLI in a clean environment
- Generate code using a sample manifest
- Compile and test the generated code in a language-specific container
- Report success or failure
Benefits Over Shell Scripts
Using Dagger for integration tests provides several advantages:
- Reproducibility: Tests run in containerized environments that are identical locally and in CI
- Language Support: Easy to add new language tests with the same pattern
- Improved Debugging: Clear separation of build, generate, and test steps
- Parallelization: Tests can run in parallel when executed in different containers
- No Dependencies: No need to install language-specific tooling locally