Test Framework Foundation
Relevant source files
The following files were used as context for generating this wiki page:
The Test Framework Foundation for flext-target-oracle-oic provides a structured, multi-layered approach to verifying the Singer Target for Oracle Integration Cloud (OIC). It utilizes pytest as the primary engine, augmented by specialized test constants, models, and protocols that follow a composition-based inheritance pattern from the core flext-tests library.
The framework is designed to support different testing scopes, ranging from unit tests of specific target logic to full end-to-end (E2E) functional tests that interact with real OIC API endpoints without mocking. It enforces modularity through lazy loading of test components and strict governance checks to maintain
Relevant source files
The following files were used as context for generating this wiki page:
The Test Framework Foundation for flext-target-oracle-oic provides a standardized, enterprise-grade environment for validating the Singer target integration with Oracle Integration Cloud (OIC). It utilizes a layered architecture that separates test data, protocols, and execution logic, ensuring high reliability and maintainability across unit and end-to-end (E2E) testing tiers.
The framework is built upon pytest and leverages a "composition inheritance" pattern where test components inherit from both general flext-tests infrastructure and project-specific domain models. This structure supports "No Mocks" real functional testing for E2E scenarios while maintaining strict governance over module structure and code quality.
Sources: tests/unit/test_e2e.py:1-17, tests/models.py:17-30, pyproject.toml:392-428
Framework Architecture
The framework is organized into specialized namespaces for constants, models, protocols, and utilities. This separation ensures that test logic remains decoupled from test data and environmental configurations.
Layered Component Structure
The testing environment is divided into three primary layers:
- Infrastructure Layer: Base classes and configurations provided by
flext-coreandflext-tests. - Domain Layer: Project-specific models (e.g., OIC Connection, Integration) and constants.
- Execution Layer: The actual test suites categorized into unit, e2e, and governance tests.
The diagram above illustrates how infrastructure and domain logic merge via composition inheritance to provide unified access points for test suites.
Sources: tests/constants.py:19-25, tests/models.py:20-30, tests/protocols.py:20-32, tests/utilities.py:19-27
Core Test Components
Constants and Configuration
Test constants are managed within the TestsFlextTargetOracleOicConstants class. This includes project-specific paths, allowed module functions for governance, and default properties for schema validation.
| Constant | Type | Description |
|---|---|---|
PROJECT_ROOT_PARENT_DEPTH | int | Directory depth to locate project root from test files. |
SRC_DIR | str | Name of the source directory ("src"). |
ALLOWED_MODULE_FUNCTIONS | dict | Map of files to sets of permitted top-level functions. |
DEFAULT_PROPERTIES | dict | Default JSON schema properties used for dummy targets. |
Sources: tests/constants.py:25-39
Composition Models and Protocols
Models use composition inheritance to provide access to both generic test fixtures and domain-specific OIC models. Protocols similarly combine standard Docker/Factory protocols with OIC-specific interfaces.
class TestsFlextTargetOracleOicModels(FlextTestsModels, FlextTargetOracleOicModels):
"""Access patterns:
- m.Tests.* (generic test models)
- m.* (Domain models via shared MRO)
"""
Sources: tests/models.py:20-35, tests/protocols.py:20-35
Test Execution and Governance
Module Governance
The framework includes automated governance checks to enforce architectural constraints. These ensure that package modules do not define unauthorized top-level loggers or functions outside of approved entry points (e.g., main in cli.py).
The governance flow validates that the internal module structure adheres to the project's engineering standards.
Sources: tests/unit/test_module_governance.py:46-83
Test Markers and Categories
Tests are categorized using pytest markers defined in pyproject.toml. This allows for selective execution based on the environment (e.g., Docker) or the scope of the test (e.g., slow vs. smoke tests).
| Marker | Description |
|---|---|
unit | Standard unit tests. |
e2e | End-to-end integration tests requiring real OIC access. |
docker | Tests requiring a Docker environment. |
governance | Architecture and structure validation tests. |
slow / stress | Performance and high-load validation. |
Sources: pyproject.toml:413-424
End-to-End (E2E) Test Foundation
The E2E suite focuses on real functional testing without mocks. It requires a valid .env file or environment variables to provide OIC credentials.
Authentication and Config Loading
The framework provides a load_test_config utility that retrieves OIC base URLs and OAuth2 credentials. It utilizes a FlextTargetOracleOicSettings model for validation.
Summary
The Test Framework Foundation establishes a rigorous environment for maintaining the flext-target-oracle-oic project. By combining automated governance with a robust E2E infrastructure and a layered composition architecture, the framework ensures that both the code structure and the OIC integration logic remain reliable and compliant with enterprise standards.