You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+21-10Lines changed: 21 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,71 +2,82 @@
2
2
3
3
## High level guidance
4
4
5
-
* Review the `CONTRIBUTING.md` file for instructions to build and test the software.
6
-
* Set the `NBGV_GitEngine` environment variable to `Disabled` before running any `dotnet` or `msbuild` commands.
5
+
- Review the `CONTRIBUTING.md` file for instructions to build and test the software.
6
+
- Set the `NBGV_GitEngine` environment variable to `Disabled` before running any `dotnet` or `msbuild` commands.
7
7
8
8
## Software Design
9
9
10
-
* Design APIs to be highly testable, and all functionality should be tested.
11
-
* Avoid introducing binary breaking changes in public APIs of projects under `src` unless their project files have `IsPackable` set to `false`.
10
+
- Design APIs to be highly testable, and all functionality should be tested.
11
+
- Avoid introducing binary breaking changes in public APIs of projects under `src` unless their project files have `IsPackable` set to `false`.
12
12
13
13
## Testing
14
14
15
15
**IMPORTANT**: This repository uses Microsoft.Testing.Platform (MTP v2) with xunit v3. Traditional `--filter` syntax does NOT work. Use the options below instead.
16
16
17
-
* There should generally be one test project (under the `test` directory) per shipping project (under the `src` directory). Test projects are named after the project being tested with a `.Tests` suffix.
18
-
* Tests use xunit v3 with Microsoft.Testing.Platform (MTP v2). Traditional VSTest `--filter` syntax does NOT work.
19
-
* Some tests are known to be unstable. When running tests, you should skip the unstable ones by using `-- --filter-not-trait "FailsInCloudTest=true"`.
17
+
- There should generally be one test project (under the `test` directory) per shipping project (under the `src` directory). Test projects are named after the project being tested with a `.Tests` suffix.
18
+
- Analyzer tests that validate _no_ diagnostics are emitted should go in `test/Microsoft.VisualStudio.Composition.Analyzers.Tests/MultiAnalyzerTests.cs`, which runs all analyzers simultaneously. Tests for specific diagnostics being emitted go in the per-analyzer test files. Add any new analyzer to the list in `test/Microsoft.VisualStudio.Composition.Analyzers.Tests/Helpers/CSharpMultiAnalyzerVerifier+Test.cs`.
19
+
- Tests use xunit v3 with Microsoft.Testing.Platform (MTP v2). Traditional VSTest `--filter` syntax does NOT work.
20
+
- Some tests are known to be unstable. When running tests, you should skip the unstable ones by using `-- --filter-not-trait "FailsInCloudTest=true"`.
20
21
21
22
### Running Tests
22
23
23
24
**Run all tests**:
25
+
24
26
```bash
25
27
dotnet test --no-build -c Release
26
28
```
27
29
28
30
**Run tests for a specific test project**:
31
+
29
32
```bash
30
33
dotnet test --project test/Library.Tests/Library.Tests.csproj --no-build -c Release
31
34
```
32
35
33
36
**Run a single test method**:
37
+
34
38
```bash
35
39
dotnet test --project test/Library.Tests/Library.Tests.csproj --no-build -c Release -- --filter-method ClassName.MethodName
36
40
```
37
41
38
42
**Run all tests in a test class**:
43
+
39
44
```bash
40
45
dotnet test --project test/Library.Tests/Library.Tests.csproj --no-build -c Release -- --filter-class ClassName
41
46
```
42
47
43
48
**Run tests with wildcard matching** (supports wildcards at beginning and/or end):
49
+
44
50
```bash
45
51
dotnet test --project test/Library.Tests/Library.Tests.csproj --no-build -c Release -- --filter-method "*Pattern*"
46
52
```
47
53
48
54
**Run tests with a specific trait** (equivalent to category filtering):
55
+
49
56
```bash
50
57
dotnet test --project test/Library.Tests/Library.Tests.csproj --no-build -c Release -- --filter-trait "TraitName=value"
51
58
```
52
59
53
60
**Exclude tests with a specific trait** (skip unstable tests):
61
+
54
62
```bash
55
63
dotnet test --project test/Library.Tests/Library.Tests.csproj --no-build -c Release -- --filter-not-trait "TestCategory=FailsInCloudTest"
56
64
```
57
65
58
66
**Run tests for a specific framework only**:
67
+
59
68
```bash
60
69
dotnet test --project test/Library.Tests/Library.Tests.csproj --no-build -c Release --framework net9.0
61
70
```
62
71
63
72
**List all available tests without running them**:
73
+
64
74
```bash
65
75
cd test/Library.Tests
66
76
dotnet run --no-build -c Release --framework net9.0 -- --list-tests
67
77
```
68
78
69
79
**Key points about test filtering with MTP v2 / xunit v3**:
80
+
70
81
- Options after `--` are passed to the test runner, not to `dotnet test`
71
82
- Use `--filter-method`, `--filter-class`, `--filter-namespace` for simple filtering
72
83
- Use `--filter-trait` and `--filter-not-trait` for trait-based filtering (replaces `--filter "TestCategory=..."`)
Copy file name to clipboardExpand all lines: test/Microsoft.VisualStudio.Composition.Analyzers.Tests/VSMEF005MultipleImportingConstructorsAnalyzerTests.cs
0 commit comments