Skip to content

docs: fix TESTING.md accuracy — unit tests do touch some OS APIs - #412

Merged
laurentiu021 merged 1 commit into
mainfrom
docs/testing-accuracy
May 15, 2026
Merged

laurentiu021 merged 1 commit into
mainfrom
docs/testing-accuracy

Conversation

@laurentiu021

@laurentiu021 laurentiu021 commented May 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes TEST-M3 finding: TESTING.md incorrectly claimed unit tests are pure (no OS access). Some tests in SysManager.Tests do access registry, process enumeration, and Task Scheduler.

Changes

  • Corrected SysManager.Tests description from 'Pure unit tests — no WPF, no WMI, no network, no process spawning' to accurately reflect that some tests touch lightweight OS APIs.
  • Updated UITests row to reflect that they now run on CI (headless runner).

Files changed (1)

TESTING.md

Build

docs: commit — no code changes.

- TEST-M3: Corrected claim that unit tests are pure (no OS access).
  Some tests access registry, process list, and Task Scheduler.
- Updated UITests row to reflect CI execution (headless runner).
@coderabbitai

coderabbitai Bot commented May 15, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

TESTING.md is updated to document which test projects run on CI versus locally. Unit tests now run on CI with a note about potential lightweight OS API usage, UI tests now run on CI headlessly (limited), and integration tests remain local-only.

Changes

Testing Documentation Update

Layer / File(s) Summary
CI testing behavior documentation
TESTING.md
The Projects table is updated to clarify that unit and UI tests now run on CI, while integration tests remain local-only. Unit test description is expanded to note they may touch lightweight OS APIs, and UI tests are marked as headless (limited) on CI rather than local-only.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • laurentiu021/SystemManager#410: Updates SECURITY.md to document CI-versus-local testing scope, overlapping with this PR's changes to testing behavior documentation.

Poem

🐰 The tests now dance on CI's stage,
Headless UI, no local cage—
Unit tests touch OS APIs light,
Integration tests stay local-right,
Documentation glows with clarity bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main documentation change: correcting an inaccuracy in TESTING.md regarding unit tests accessing OS APIs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/testing-accuracy

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@TESTING.md`:
- Line 9: The README line for SysManager.Tests overstates OS API usage; update
the documentation so it only lists APIs actually invoked: remove "Registry
reads" and "Process enumeration" and replace with a note that tests call
Process.GetCurrentProcess(), and clarify that Task Scheduler is only referenced
via the StartupSource.TaskScheduler enum in test data (no Task Scheduler API
calls). Edit the table entry for `SysManager.Tests` to reflect these exact
symbols (Process.GetCurrentProcess, StartupSource.TaskScheduler) and remove any
claim of registry or broader process enumeration usage.
- Line 11: Update the TESTING.md table entry for SysManager.UITests to remove
the incorrect "headless" descriptor: locate the row containing
`SysManager.UITests` and change the status cell from "✅ CI (headless, limited)"
to something that reflects a full desktop session (e.g. "✅ CI (desktop session,
limited)" or simply "✅ CI (limited)"), ensuring "limited" is preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 569c7a7d-2431-4d16-a018-48fa2ad464a0

📥 Commits

Reviewing files that changed from the base of the PR and between da07366 and 6da4095.

📒 Files selected for processing (1)
  • TESTING.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build & unit tests
  • GitHub Check: Analyze (csharp)

Comment thread TESTING.md
| Project | What it tests | Runs on CI |
|---|---|---|
| `SysManager.Tests` | Pure unit tests — no WPF, no WMI, no network, no process spawning | ✅ Every push / PR |
| `SysManager.Tests` | Unit tests — mostly pure logic, but some tests touch lightweight OS APIs (registry reads, process enumeration, Task Scheduler queries). No WPF dispatcher, no WMI, no network I/O, no admin required. | ✅ Every push / PR |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify that SysManager.Tests actually uses the OS APIs mentioned in the documentation.

echo "=== Searching for Registry API usage in SysManager.Tests ==="
rg -n --type=cs -C3 'Registry\.' --glob '**/SysManager.Tests/**' --glob '!**/obj/**' --glob '!**/bin/**'

echo -e "\n=== Searching for Process enumeration API usage ==="
rg -n --type=cs -C3 'Process\.(GetProcesses|GetProcessById|GetCurrentProcess)' --glob '**/SysManager.Tests/**' --glob '!**/obj/**' --glob '!**/bin/**'

echo -e "\n=== Searching for Task Scheduler API usage ==="
rg -n --type=cs -C3 'TaskScheduler|TaskService' --glob '**/SysManager.Tests/**' --glob '!**/obj/**' --glob '!**/bin/**'

echo -e "\n=== Verifying absence of WMI, WPF dispatcher usage in unit tests ==="
rg -n --type=cs 'ManagementObjectSearcher|Dispatcher\.(Invoke|BeginInvoke)' --glob '**/SysManager.Tests/**' --glob '!**/obj/**' --glob '!**/bin/**' || echo "✓ No WMI or WPF dispatcher usage found (as expected)"

Repository: laurentiu021/SystemManager

Length of output: 4862


Documentation claims about OS API usage in SysManager.Tests are inaccurate and need correction.

Verification of the claimed OS API usage shows:

  • Registry reads: Not found in test code (claimed but absent)
  • Process enumeration: Only Process.GetCurrentProcess() found; no broader process enumeration like GetProcesses()
  • Task Scheduler queries: Tests reference StartupSource.TaskScheduler enum values in test data but do not actually call Task Scheduler APIs

The documentation should be updated to accurately reflect only the OS APIs actually invoked in the tests, not the broader scope currently claimed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@TESTING.md` at line 9, The README line for SysManager.Tests overstates OS API
usage; update the documentation so it only lists APIs actually invoked: remove
"Registry reads" and "Process enumeration" and replace with a note that tests
call Process.GetCurrentProcess(), and clarify that Task Scheduler is only
referenced via the StartupSource.TaskScheduler enum in test data (no Task
Scheduler API calls). Edit the table entry for `SysManager.Tests` to reflect
these exact symbols (Process.GetCurrentProcess, StartupSource.TaskScheduler) and
remove any claim of registry or broader process enumeration usage.

Comment thread TESTING.md
| `SysManager.Tests` | Unit tests — mostly pure logic, but some tests touch lightweight OS APIs (registry reads, process enumeration, Task Scheduler queries). No WPF dispatcher, no WMI, no network I/O, no admin required. | ✅ Every push / PR |
| `SysManager.IntegrationTests` | Integration tests — real Windows APIs (Event Log, WMI, PowerShell, ICMP, WPF dispatcher) | ❌ Local only |
| `SysManager.UITests` | End-to-end UI automation via FlaUI | ❌ Local only (needs a desktop session) |
| `SysManager.UITests` | End-to-end UI automation via FlaUI | ✅ CI (headless, limited) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify that CI configuration actually runs SysManager.UITests.

echo "=== Searching for CI workflow files ==="
fd -e yml -e yaml . .github/workflows 2>/dev/null || echo "No .github/workflows directory found"

echo -e "\n=== Checking for UITests in CI configuration ==="
rg -n 'SysManager\.UITests' --glob '**/.github/workflows/*.yml' --glob '**/.github/workflows/*.yaml' -C5 || echo "No UITests reference found in workflow files"

echo -e "\n=== Checking for headless execution settings ==="
rg -n 'headless|HEADLESS|Xvfb' --glob '**/.github/workflows/*.yml' --glob '**/.github/workflows/*.yaml' -C3 || echo "No explicit headless configuration found"

Repository: laurentiu021/SystemManager

Length of output: 731


🏁 Script executed:

#!/bin/bash
# Read the main CI workflow file
echo "=== Reading .github/workflows/ci.yml ==="
cat .github/workflows/ci.yml

echo -e "\n=== Reading TESTING.md around line 11 ==="
cat -n TESTING.md | head -20

Repository: laurentiu021/SystemManager

Length of output: 4829


Remove "headless" descriptor — UITests run on full Windows desktop session, not headless.

The documentation correctly states that SysManager.UITests runs on CI, but the "headless" descriptor is inaccurate. The CI workflow explicitly runs on windows-latest, which provides a full desktop session for UI automation. The ci.yml workflow confirms this with the comment: "UI tests need a desktop session; windows-latest provides one." The "limited" qualifier is accurate (tests only run on push and PRs from the same repository, not fork PRs).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@TESTING.md` at line 11, Update the TESTING.md table entry for
SysManager.UITests to remove the incorrect "headless" descriptor: locate the row
containing `SysManager.UITests` and change the status cell from "✅ CI (headless,
limited)" to something that reflects a full desktop session (e.g. "✅ CI (desktop
session, limited)" or simply "✅ CI (limited)"), ensuring "limited" is preserved.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@laurentiu021
laurentiu021 merged commit 751b69b into main May 15, 2026
5 checks passed
@laurentiu021
laurentiu021 deleted the docs/testing-accuracy branch May 15, 2026 15:13
laurentiu021 added a commit that referenced this pull request May 22, 2026
…y-catch) (#462)

## Summary
Resolves the last 5 fixable CodeQL alerts in the codebase:

| Alert | Rule | File | Fix |
|-------|------|------|-----|
| #509 | cs/linq/missed-where | UninstallerService.cs | Replaced
foreach+ContainsKey with TryAdd |
| #508 | cs/linq/missed-select | NetworkSharedState.cs | Converted
foreach+map to .Select().ToList() |
| #507 | cs/linq/missed-select | IconExtractorService.cs | Converted
foreach+map to .Select().FirstOrDefault() |
| #412 | cs/linq/missed-select | IconExtractorService.cs | Converted
foreach+IndexOf to LINQ pipeline |
| #445 | cs/empty-catch-block | StartupService.cs | Added Log.Debug to
empty catch |

## Remaining CodeQL alerts
All remaining alerts are either:
- P/Invoke / unmanaged code declarations (acceptable, required for Win32
interop)
- Auto-generated code in obj/ (not our code)

## Testing
- Build: 0 errors
- No behavioral changes (pure style refactoring)
- CI will validate

Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
laurentiu021 added a commit that referenced this pull request May 22, 2026
- TEST-M3: Corrected claim that unit tests are pure (no OS access).
  Some tests access registry, process list, and Task Scheduler.
- Updated UITests row to reflect CI execution (headless runner).

Co-authored-by: laurentiu021 <laurentiu021@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants