Test Harnesses
Before calling a scenario untestable, or proposing a new harness, check this table and ls the
TestSupport folders. Details live in [[glue-live-game-testing]] (real game process) and
[[glue-unit-test-bootstrap]] (headless Glue, gold projects).
| Need | Harness | Category |
|---|---|---|
| Glue-side socket behavior with no game | FRBDK\Glue\Tests\GlueUnitTests\GameCommunicationPlugin\FakeGameSide.cs | default |
| Real project loaded headlessly in Glue, codegen run, built, live-edit code embedded | TestSupport\GoldProject.cs | BuildSmoke |
| Built game launched and driven over the real live-edit socket | TestSupport\LiveGameProcess.cs | LiveGame |
| Embedded (game-side) logic compiled and run in a scratch game project | pattern explained in GlueControl\VariableAssignmentLogicEnumConversionTests.cs | BuildSmoke |
| #if version gates in embedded code, no build | GlueControl\EmbeddedVersionGateTests.cs (Roslyn) | default |
| Embedded files that compile without a game, run in-process | Tests\EngineUnitTests links them in with <Compile Include ... Link> | engine tests |
Gotchas
- A race doesn't need to happen for real to be tested. Put the files and timestamps into the state the race leaves behind, then launch.
- Extending a harness beats working around it. If
LiveGameProcess.StartAsyncorGoldProjectlacks a hook for the step you need, add the hook there. LoadFormsSampleAsyncchanges the rest of the test run. It registers every plugin's asset types for the whole process, so unrelated codegen tests start generating different text (Map = XbecomesMap = X.Clone()). Build the project in memory unless the test is about project load;ExposedVariableSyncTestsshows the shape.- A running Glue breaks the test build. It holds
GlueFormsCore.exeand.dllin the Debug output, sodotnet testfails with MSB3027. Close Glue, or run the tests from a throwaway detached worktree.