一键导入
integration-testing
Integration test patterns for Rust game engine with GL context and FFI boundaries
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Integration test patterns for Rust game engine with GL context and FFI boundaries
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Pick the fastest build/verify command for the change at hand, from cargo check to the full verify gate
Run and troubleshoot the SDK code generation pipeline (./codegen.sh) and the generated-artifact drift gate
How versioning and releases work via release-please, version.txt, and the version pins across the workspace
Build and debug the WASM browser target and the TypeScript web SDK, including the wasm-pack path and the debugger WebSocket relay
Dependency flow audit and layer validation for GoudEngine's 5-layer hierarchy
Discover and list available skills in the repository
基于 SOC 职业分类
| name | integration-testing |
| description | Integration test patterns for Rust game engine with GL context and FFI boundaries |
| user-invocable | true |
Patterns and conventions for writing integration tests in GoudEngine, covering cross-module interactions, GL context management, and FFI boundary testing.
Use when writing tests that exercise multiple modules together, test FFI boundaries end-to-end, or validate SDK wrappers against the Rust core.
goud_engine/
├── src/
│ ├── ecs/
│ │ └── mod.rs # Unit tests in #[cfg(test)] module
│ ├── ffi/
│ │ └── mod.rs # Unit tests for FFI functions
│ └── libs/graphics/
│ └── mod.rs # Unit tests (may need GL context)
├── tests/ # Integration tests
│ ├── ecs_integration.rs
│ ├── ffi_integration.rs
│ └── graphics_integration.rs
└── benches/ # Benchmarks (criterion)
└── ecs_bench.rs
sdks/ # 10 language SDKs: c, cpp, csharp, go,
├── csharp.tests/ # kotlin, lua, python, rust, swift, typescript
│ # C# SDK tests (xUnit)
├── python/
│ └── test_bindings.py # Python SDK tests
└── typescript/ # TypeScript SDK tests (npm test)
Every FFI export MUST have a binding in all 10 SDKs. The generated ffi_manifest.json is the contract; codegen/validate_coverage.py gates coverage across the full matrix.
Many graphics tests require an OpenGL context. Use the helper:
use crate::test_helpers::init_test_context;
#[test]
fn test_renderer_initialization() {
let _ctx = init_test_context();
// GL-dependent test code here
}
Rules:
init_test_context() at the startCreate reusable factories for common test objects:
#[cfg(test)]
mod test_helpers {
use super::*;
pub fn create_test_entity(world: &mut World) -> Entity {
let entity = world.spawn();
world.add_component(entity, Transform2D::default());
entity
}
pub fn create_test_sprite(world: &mut World, entity: Entity) {
world.add_component(entity, Sprite::new("test_texture"));
}
}
Test the full path: Rust → FFI → SDK wrapper.
#[test]
fn test_ffi_create_entity_roundtrip() {
// 1. Create context via FFI
let ctx = unsafe { ffi::create_context() };
assert!(!ctx.is_null());
// 2. Create entity via FFI
let entity_id = unsafe { ffi::create_entity(ctx) };
assert!(entity_id > 0);
// 3. Clean up
unsafe { ffi::destroy_context(ctx) };
}
FFI test rules:
Verify the same operation produces the same result across every SDK that has a test harness:
test_bindings.py)csharp.tests/)sdks/typescript, npm test)The remaining SDKs (go, kotlin, lua, swift, rust, c, cpp) share the same FFI contract; extend parity coverage to them as their harnesses mature.
| Category | Location | Needs GL | Run Command |
|---|---|---|---|
| Unit (Rust) | #[cfg(test)] in source | Depends | cargo test |
| Integration (Rust) | goud_engine/tests/ | Often | cargo test --test <name> |
| FFI boundary | goud_engine/tests/ | Sometimes | cargo test --test ffi_* |
| Python SDK | sdks/python/test_bindings.py | No | python3 sdks/python/test_bindings.py |
| C# SDK | sdks/csharp.tests/ | No | dotnet test sdks/csharp.tests/ |
| TypeScript SDK | sdks/typescript/ | No | cd sdks/typescript && npm test |
| SDK coverage gate | codegen/validate_coverage.py | No | python3 codegen/validate_coverage.py |
| Benchmarks | goud_engine/benches/ | Sometimes | cargo bench |
Before submitting integration tests:
init_test_context()#[ignore] or todo!() in test code