Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
- name: Run tests
# The '--' separator forwards options to the Microsoft Testing Platform runner.
# After upgrading to .NET 10 SDK, these can be passed directly without '--'.
run: dotnet test --no-build --configuration Debug -- --coverage --coverage-output-format cobertura
# Override the default Integration-test exclusion from test/Directory.Build.props.
run: dotnet test --no-build --configuration Debug -p:TestingPlatformCommandLineArguments="--coverage --coverage-output-format cobertura"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
Expand Down
18 changes: 16 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ Analysis rulesets are defined in [analyzers.ruleset](analyzers.ruleset) and vali

### Testing

L0s are defined in `Microsoft.ComponentDetection.*.Tests`.
**Unit tests (L0s)** are defined in `Microsoft.ComponentDetection.*.Tests` and should be fast, isolated, and free of external process calls.

Verification tests are run on the sample projects defined in [microsoft/componentdetection-verification](https://github.com/microsoft/componentdetection-verification).
**Integration tests** spawn real processes (e.g. `dotnet build`, `dotnet restore`) and are therefore slower and environment-dependent. Tag these with `[TestCategory("Integration")]` so they can be filtered during local development.

By default, `dotnet test` **excludes** Integration tests (configured in `test/Directory.Build.props`). CI runs all tests including Integration (see `.github/workflows/build.yml`).

To run only Integration tests locally:
```bash
dotnet test -- --filter "TestCategory=Integration"
```

To run everything (same as CI):
```bash
dotnet test -p:TestingPlatformCommandLineArguments=""
```

**Verification tests** are run on the sample projects defined in [microsoft/componentdetection-verification](https://github.com/microsoft/componentdetection-verification).
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="MSBuild.StructuredLogger" Version="2.3.113" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageVersion Include="DotNet.Glob" Version="2.1.1" />
<PackageVersion Include="MinVer" Version="7.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
<InternalsVisibleTo Include="Microsoft.ComponentDetection.Orchestrator.Tests" />
<InternalsVisibleTo Include="Microsoft.ComponentDetection.Detectors.Tests" />
<InternalsVisibleTo Include="Microsoft.ComponentDetection.TestsUtilities" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="DotNet.Glob" />
<PackageReference Include="MSBuild.StructuredLogger" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="morelinq" />
<PackageReference Include="NuGet.ProjectModel" />
Expand Down
Loading
Loading