diff --git a/.agents/README.md b/.agents/README.md index fd86c06f7f4..94f1478ad2a 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -35,6 +35,7 @@ This matrix documents how canonical skills in `.agents/skills/` are exposed in e | Canonical skill | Cursor | Copilot (VS Code/GitHub) | Claude Code | |---|---|---|---| +| `dynamo-build-tests` | Loaded directly from `.agents/skills/dynamo-build-tests/SKILL.md` | — | Loaded directly from `.agents/skills/dynamo-build-tests/SKILL.md` | | `dynamo-codebase-patterns` | Loaded directly from `.agents/skills/dynamo-codebase-patterns/SKILL.md` | Wrapper: `.github/agents/dynamo-codebase-patterns.agent.md` | Loaded directly from `.agents/skills/dynamo-codebase-patterns/SKILL.md` | | `dynamo-content-designer` | Loaded directly from `.agents/skills/dynamo-content-designer/SKILL.md` | Wrapper: `.github/agents/dynamo-content-designer.agent.md` | Loaded directly from `.agents/skills/dynamo-content-designer/SKILL.md` | | `dynamo-dotnet-expert` | Loaded directly from `.agents/skills/dynamo-dotnet-expert/SKILL.md` | Wrapper: `.github/agents/dynamo-dotnet-expert.agent.md` | Loaded directly from `.agents/skills/dynamo-dotnet-expert/SKILL.md` | @@ -42,6 +43,7 @@ This matrix documents how canonical skills in `.agents/skills/` are exposed in e | `dynamo-ecosystem-reviewer` | Loaded directly from `.agents/skills/dynamo-ecosystem-reviewer/SKILL.md` | Wrapper: `.github/agents/dynamo-ecosystem-reviewer.agent.md` | Loaded directly from `.agents/skills/dynamo-ecosystem-reviewer/SKILL.md` | | `dynamo-onboarding` | Loaded directly from `.agents/skills/dynamo-onboarding/SKILL.md` | Wrapper: `.github/agents/dynamo-onboarding.agent.md` | Loaded directly from `.agents/skills/dynamo-onboarding/SKILL.md` | | `dynamo-pr-description` | Loaded directly from `.agents/skills/dynamo-pr-description/SKILL.md` | Wrapper: `.github/agents/dynamo-pr-description.agent.md` | Loaded directly from `.agents/skills/dynamo-pr-description/SKILL.md` | +| `dynamo-run-tests` | Loaded directly from `.agents/skills/dynamo-run-tests/SKILL.md` | — | Loaded directly from `.agents/skills/dynamo-run-tests/SKILL.md` | | `dynamo-jira-ticket` | Loaded directly from `.agents/skills/dynamo-jira-ticket/SKILL.md` | Wrapper: `.github/agents/dynamo-jira-ticket.agent.md` | Loaded directly from `.agents/skills/dynamo-jira-ticket/SKILL.md` | | `dynamo-skill-writer` | Loaded directly from `.agents/skills/dynamo-skill-writer/SKILL.md` | Wrapper: `.github/agents/dynamo-skill-writer.agent.md` | Loaded directly from `.agents/skills/dynamo-skill-writer/SKILL.md` | | `dynamo-unit-testing` | Loaded directly from `.agents/skills/dynamo-unit-testing/SKILL.md` | Wrapper: `.github/agents/dynamo-unit-testing.agent.md` | Loaded directly from `.agents/skills/dynamo-unit-testing/SKILL.md` | @@ -61,6 +63,7 @@ Each skill lives in its own folder with a `SKILL.md` and optionally a `template. | Skill | When to use | Repo scope | |-------|-------------|------------| +| [dynamo-build-tests](skills/dynamo-build-tests/SKILL.md) | Building test projects so DLLs reflect latest source changes. | Repo-specific variant | | [dynamo-codebase-patterns](skills/dynamo-codebase-patterns/SKILL.md) | Discovering and enforcing non-obvious Dynamo structural patterns in scans and reviews. | Repo-specific variant | | [dynamo-content-designer](skills/dynamo-content-designer/SKILL.md) | Writing documentation, tutorials, release notes, and user-facing technical content. | Repo-specific variant | | [dynamo-dotnet-expert](skills/dynamo-dotnet-expert/SKILL.md) | Writing or reviewing C#/.NET code. Code design, testing, performance, PublicAPI management. | Repo-specific variant | @@ -68,6 +71,7 @@ Each skill lives in its own folder with a `SKILL.md` and optionally a `template. | [dynamo-ecosystem-reviewer](skills/dynamo-ecosystem-reviewer/SKILL.md) | Reviewing changes for ecosystem compatibility and cross-repo/platform constraints. | Repo-specific variant | | [dynamo-onboarding](skills/dynamo-onboarding/SKILL.md) | Learning the Dynamo codebase, architecture briefings, finding where to start on a Jira ticket. | Repo-specific variant | | [dynamo-pr-description](skills/dynamo-pr-description/SKILL.md) | Writing PR descriptions matching the Dynamo template. | Repo-specific variant | +| [dynamo-run-tests](skills/dynamo-run-tests/SKILL.md) | Running NUnit tests by name, filter, or project. | Repo-specific variant | | [dynamo-jira-ticket](skills/dynamo-jira-ticket/SKILL.md) | Creating or refining Jira tickets from bugs, test failures, or feature requests. | Repo-specific variant | | [dynamo-skill-writer](skills/dynamo-skill-writer/SKILL.md) | Authoring and updating skills; writing high-quality skill instructions; managing sync across Copilot, Cursor, and Claude surfaces. | Repo-specific variant | | [dynamo-unit-testing](skills/dynamo-unit-testing/SKILL.md) | Writing NUnit tests following Dynamo patterns. Test classes, setup/teardown, .dyn file testing. | Repo-specific variant | @@ -94,6 +98,8 @@ Templates are co-located inside the skill folder that uses them: ``` .agents/ ├── skills/ +│ ├── dynamo-build-tests/ +│ │ └── SKILL.md │ ├── dynamo-codebase-patterns/ │ │ ├── SKILL.md │ │ └── patterns/ @@ -110,6 +116,8 @@ Templates are co-located inside the skill folder that uses them: │ │ └── SKILL.md │ ├── dynamo-pr-description/ │ │ └── SKILL.md +│ ├── dynamo-run-tests/ +│ │ └── SKILL.md │ ├── dynamo-jira-ticket/ │ │ ├── SKILL.md │ │ └── assets/ diff --git a/.agents/skills/dynamo-build-tests/SKILL.md b/.agents/skills/dynamo-build-tests/SKILL.md new file mode 100644 index 00000000000..838270e9220 --- /dev/null +++ b/.agents/skills/dynamo-build-tests/SKILL.md @@ -0,0 +1,90 @@ +--- +name: dynamo-build-tests +description: Build Dynamo test projects so test DLLs reflect the latest source changes. Use this skill when you need to compile test projects before running tests, when dotnet build fails on satellite assembly projects, or when you see "discovered 0 of 0 NUnit test cases" because the DLL is stale. +--- + +# Dynamo Build Tests + +## When to use +- Compiling test projects before running tests +- Rebuilding a specific test DLL after editing test or production code +- Troubleshooting build failures in the test pipeline (e.g. `MSB4803`, missing LibG) + +## When not to use +- Running tests -- use `dynamo-run-tests` instead +- Writing test code -- use `dynamo-unit-testing` instead + +## Inputs expected +The name of the test project or area being tested (e.g. "DynamoCoreWpf3Tests", "DynamoCoreTests"). + +## Output format +Confirmation that the build succeeded with 0 errors in the target project, or a diagnosis of any failures. + +--- + +## Workflow + +### 1. Resolve tool paths + +Do not hardcode tool paths. Obtain `` and `` from your environment before running any commands: + +- **Claude Code users**: read `reference_build_tools.md` from the personal memory file (`~/.claude/projects//memory/reference_build_tools.md` — not part of the repo). Update it if a path is stale. +- **All users**: discover MSBuild via `vswhere`: + +```bash +"/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find "MSBuild\**\Bin\MSBuild.exe" +``` + +Use the resolved paths as `` and `` in the commands below. + +### 2. Build the test project + +**Preferred: MSBuild** (this repo builds with MSBuild; it handles all project types correctly): + +```bash +"" "test//.csproj" "-p:Configuration=Release" "-v:q" "-nologo" +``` + +> **Important**: When calling MSBuild from bash, quote all flag arguments (e.g. `"-p:Configuration=Release"`) to prevent the shell from interpreting `/p:` as a path. + +**Fallback: `dotnet build --no-dependencies`** if MSBuild is unavailable. This compiles only the specified project against pre-built dependency DLLs already in the output folder, avoiding `MSB4803` errors from satellite assembly tasks: + +```bash +"" build test//.csproj -c Release --no-restore --no-dependencies -v q +``` + +**If `dotnet build --no-dependencies` fails** because dependency DLLs are missing from the output folder, they need to be built first. Rebuild the production project, then the test project — both with `--no-dependencies`: + +```bash +"" build src//.csproj -c Release --no-restore --no-dependencies -v q +"" build test//.csproj -c Release --no-restore --no-dependencies -v q +``` + +### 3. Verify success + +Check the build output for `0 Error(s)` in the target project. Filter out known pre-existing errors from unrelated projects: +- `MSB4803` from `DynamoUnits` / `DesignScriptBuiltin` (satellite assembly task not supported on .NET Core MSBuild) +- `MSB3030` from `DynamoCore` (missing LibG.Interface.dll — build environment issue) + +These are infrastructure issues, not code errors. + +## Finding test projects + +Discover available test projects from the repo: + +```bash +find test -name "*.csproj" | sort +``` + +> **Exception**: The visualization test assembly is `WpfVisualizationTests`, but its directory is `test/VisualizationTests/` — directory and project name differ. All other projects follow the `test//.csproj` pattern. + +Test DLLs are output to `bin/AnyCPU/Release/.dll`. + +## Boundaries + +- ✅ **Always**: build test and production projects, report errors +- ⚠️ **Ask first**: modify `.csproj` files, change build configuration +- 🚫 **Never**: delete build output folders, modify `Directory.Build.props` + +## Related skills +`dynamo-run-tests` • `dynamo-unit-testing` diff --git a/.agents/skills/dynamo-run-tests/SKILL.md b/.agents/skills/dynamo-run-tests/SKILL.md new file mode 100644 index 00000000000..823fffb1297 --- /dev/null +++ b/.agents/skills/dynamo-run-tests/SKILL.md @@ -0,0 +1,123 @@ +--- +name: dynamo-run-tests +description: Run NUnit tests in the Dynamo repo using dotnet test. Use this skill when executing tests by name, filter, or project — including verifying a fix, running regression suites, or checking specific test results. +--- + +# Dynamo Run Tests + +## When to use +- Running specific tests by name or filter after a code change +- Running all tests in a project to check for regressions +- Verifying that new tests pass +- Debugging test failures (re-running with verbose output) + +## When not to use +- Building test projects -- use `dynamo-build-tests` instead +- Writing test code -- use `dynamo-unit-testing` instead + +## Inputs expected +The test project, and optionally a filter (test name, class name, or category). + +## Output format +Pass/fail summary with counts. For failures: the failing test name, assertion message, and relevant stack trace. + +--- + +## Workflow + +### 1. Resolve tool path + +Do not hardcode the `dotnet` path. Obtain `` from your environment: + +- **Claude Code users**: read `reference_build_tools.md` from the personal memory file (`~/.claude/projects//memory/reference_build_tools.md` — not part of the repo). +- **All users**: run `where dotnet` (Windows) or `which dotnet` (bash) to locate it. + +### 2. Find the test project + +Discover available test projects: + +```bash +find test -name "*.csproj" | sort +``` + +> **Exception**: The visualization test assembly is `WpfVisualizationTests`, but its directory is `test/VisualizationTests/` — directory and project name differ. All other projects follow the `test//.csproj` pattern. + +### 3. Ensure the DLL is current + +If you edited test or production code since the last build, rebuild first using `dynamo-build-tests`. A stale DLL will either miss new tests ("discovered 0 of 0") or run old code. + +### 4. Run tests + +Use `dotnet test` with `--no-build` to skip recompilation (since you built in step 3): + +```bash +# Run specific test(s) by name substring +"" test test//.csproj -c Release --no-restore --no-build --filter "FullyQualifiedName~" -v n + +# Run all tests in a test class +"" test test//.csproj -c Release --no-restore --no-build --filter "FullyQualifiedName~" -v n + +# Run all tests in a project +"" test test//.csproj -c Release --no-restore --no-build -v n +``` + +> **Important**: Always use `--no-restore --no-build` to avoid triggering the `MSB4803` satellite assembly errors from `DynamoUnits`/`DesignScriptBuiltin`. The DLL must already be built. + +### 5. Interpret results + +**Successful output** ends with: +``` +Test Run Successful. +Total tests: N + Passed: N +``` + +**Failed output** includes assertion details: +``` +Failed TestName [Xs] + Error Message: + Expected: ... + But was: ... +``` + +### Filter syntax + +The `--filter` flag uses `dotnet test` filter expressions: + +| Goal | Filter | +|---|---| +| Test name contains substring | `"FullyQualifiedName~UnpinGroupedNote"` | +| Exact test name | `"FullyQualifiedName=DynamoCoreWpfTests.NoteViewTests.UnpinGroupedNote_NoteRemainsInGroup"` | +| All tests in a class | `"FullyQualifiedName~NoteViewTests"` | + +Multiple tests (OR) — use a literal `|` inside the quoted filter string: + +```bash +--filter "FullyQualifiedName~TestA|FullyQualifiedName~TestB" +``` + +### Verbosity levels + +| Flag | Shows | +|---|---| +| `-v q` | Quiet — pass/fail summary only | +| `-v n` | Normal — test names and timing (recommended) | +| `-v d` | Detailed — full output including stdout from tests | + +## Troubleshooting + +| Symptom | Cause | Fix | +|---|---|---| +| "discovered 0 of 0 NUnit test cases" | DLL is stale — new tests not compiled | Rebuild with `dynamo-build-tests` (step 3) | +| `MSB4803` errors | `--no-build` was omitted or `dotnet test` triggered a rebuild | Add `--no-restore --no-build` flags | +| Test passes but behavior is wrong | Production DLL is stale | Rebuild the production project too | +| `No test matches the given testcase filter` | Filter typo or wrong project | Check spelling; try broader filter like class name | + +## Boundaries + +- ✅ **Always**: run tests, report results, rerun with different verbosity +- ⚠️ **Ask first**: run the entire solution's test suite (can take a long time) +- 🚫 **Never**: add `[Ignore]` or `[Explicit]` to make tests pass; weaken assertions + +## Related skills +`dynamo-build-tests` • `dynamo-unit-testing` diff --git a/AGENTS.md b/AGENTS.md index 73740b9bc5d..2929a028344 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -139,6 +139,7 @@ For each new node, add to `doc/distrib/NodeHelpFiles/`: Read `.agents/` for comprehensive skills, rules, and templates: - **Skills** (task workflows): `.agents/skills//SKILL.md` + - `dynamo-build-tests` -- Build test projects so DLLs reflect latest source changes - `dynamo-codebase-patterns` -- Discover and enforce Dynamo-specific architectural patterns - `dynamo-content-designer` -- Technical content for docs, guides, and release notes - `dynamo-dotnet-expert` -- C#/.NET patterns, testing, PublicAPI @@ -147,6 +148,7 @@ Read `.agents/` for comprehensive skills, rules, and templates: - `dynamo-jira-ticket` -- creating/refining Jira tickets (includes template.md) - `dynamo-onboarding` -- Dynamo architecture, ecosystem, debugging - `dynamo-pr-description` -- PR descriptions matching Dynamo template (uses `.github/PULL_REQUEST_TEMPLATE.md`) + - `dynamo-run-tests` -- Run NUnit tests by name, filter, or project - `dynamo-skill-writer` -- Author and maintain Dynamo agent skills - `dynamo-unit-testing` -- NUnit test writing following Dynamo patterns - `dynamo-ux-designer` -- UX planning and Weave-aligned interface design guidance