summaryrefslogtreecommitdiff
path: root/test/README.md
blob: 61eb577d8d31747e277e5168ebcdc257713c094d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Integration Tests

This folder contains integration tests that validate the `AggregateConfigBuildTask` NuGet package functionality in realistic scenarios.

## About Integration Tests

These tests differ from the [unit tests](../src/UnitTests/) in that they:

- Test the complete NuGet package functionality end-to-end
- Use actual file system operations and MSBuild task execution
- Validate the package works correctly when installed as a NuGet dependency
- Run against multiple operating systems (Windows, Linux, macOS) in CI/CD

## Running Integration Tests

### Prerequisites

The integration tests require the NuGet package to be available. By default, they use the version specified in `Directory.Packages.props`, but can be configured to use a different version for CI/CD testing.

### Version Management

- **Default behavior**: Uses the `AggregateConfigBuildTask` version from `Directory.Packages.props`
- **CI/CD testing**: Set `UseLocalPackageVersion=true` to use the version specified by the `Version` property

### Running Tests

1. **Build and run everything together** (recommended):
   ```bash
   dotnet build dirs.proj --configuration Release
   dotnet test test/dirs.proj --configuration Release --no-build
   ```

2. **Test with a specific package version** (useful for CI/CD):
   ```bash
   dotnet test test/dirs.proj --configuration Release -p:UseLocalPackageVersion=true -p:Version=1.2.3
   ```

3. **Manually provide the NuGet package**:
   First, build the package:
   ```bash
   dotnet pack src/Task/AggregateConfigBuildTask.csproj --configuration Release
   ```
   
   Then add it as a local NuGet source and run the tests:
   ```bash
   dotnet nuget add source ./src/Task/bin/Release --name AggregateConfigBuildTask-Local
   dotnet test test/dirs.proj --configuration Release
   ```

## Test Structure

- **IntegrationTests/** - Contains the integration test project
- **dirs.proj** - MSBuild traversal project for building and running integration tests

## Related Tests

For unit tests that test individual components and methods, see the [unit tests folder](../src/UnitTests/).