Skip to content

test(unit): cover ProjectFactory default environment variables and directory fallback - #260

Merged
samtrion merged 1 commit into
mainfrom
test/stryker-projectfactory-default-env-vars
Nov 4, 2026
Merged

samtrion merged 1 commit into
mainfrom
test/stryker-projectfactory-default-env-vars

Conversation

@samtrion

@samtrion samtrion commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Mutation report for src/NetEvolve.ProjectBuilders/ProjectFactory.cs (latest successful mutation run): 12 mutants survive on lines 83-94 (83, 85, 88, 90, 91 x2, 92 x2, 93 x2, 94). File total: 56 survived, 35 killed, 9 NoCoverage, 7 compile errors, 24 ignored. Nothing asserts the default values.

Root cause

ProjectFactoryTests only checks variables the test adds itself (MY_VAR, VAR_A, VAR_B). The default dictionary (CI/GITHUB_ACTIONS null, three DOTNET_* values) and the directory ?? constructor fallback are never asserted.

Change

Tests only, in ProjectFactoryTests.cs:

  • Create_Default_SetsDefaultEnvironmentVariables: exact 5 entries incl. null for CI and GITHUB_ACTIONS, plus a case-insensitive lookup.
  • Create_WithoutDirectory_UsesTemporaryDirectoryBuilder and Create_WithDirectory_UsesProvidedDirectory: cover the line 85 fallback.

Before / After

metric before after
ProjectFactory.cs survivors on lines 83-94 12 1 (line 83 logger)
ProjectFactory.cs survived / killed 56 / 35 46 / 45
overall mutation score 74.73 % 76.87 %
mutants created 603 603
compile errors / no coverage / ignored 27 / 27 / 109 27 / 27 / 109
duration 9m 09s 10m 27s (runner variance)

After run: https://github.com/dailydevops/projectbuilders/actions/runs/40810176064 (success).

The remaining line 83 survivor (logger ?? NullLogger) is not covered: _logger is only used in BuildAsync on SARIF output paths. The line 88 mutant replaces the initializer with {} (the comparer is kept), so the ci lookup is a harmless extra.

Risk / what this does not change

No production code changes; AddEnvironmentVariable validation is untouched. Tests dispose the factory and temporary directory.

…rectory fallback

Stryker reports 12 surviving mutants on ProjectFactory.cs lines 83-94
(constructor fallbacks and the default environment variable dictionary).
Existing tests only inspect variables they add themselves.

Assert the five default entries (CI and GITHUB_ACTIONS as null, the three
DOTNET_* values), the temporary directory fallback and that a provided
directory is used as-is.
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.69%. Comparing base (3375b9a) to head (5808f3c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #260   +/-   ##
=======================================
  Coverage   89.69%   89.69%           
=======================================
  Files          31       31           
  Lines         728      728           
  Branches       85       85           
=======================================
  Hits          653      653           
  Misses         67       67           
  Partials        8        8           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samtrion
samtrion merged commit a401fe8 into main Nov 4, 2026
24 of 25 checks passed
@samtrion
samtrion deleted the test/stryker-projectfactory-default-env-vars branch November 4, 2026 00:26
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.

1 participant