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: docs/test/debug-unit-tests-with-test-explorer.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,16 +28,16 @@ You can use Test Explorer to start a debugging session for your tests. Stepping
28
28

29
29
::: moniker-end
30
30
31
-
For more information, about the debugger, see [Debug in Visual Studio](../debugger/debugger-feature-tour.md).
31
+
For more information about the debugger, see [Debug in Visual Studio](../debugger/debugger-feature-tour.md).
32
32
33
33
## Diagnose performance problems with a test method
34
34
35
35
::: moniker range=">=vs-2022"
36
-
Starting in Visual Studio 2022 version 17.8, you can use any applicable tool in the Performance Profiler to help improve your code, and not just the Instrumentation tool. You can profile small units of work in isolation, make changes, and then remeasure and validate the impact of the change.
36
+
Starting in Visual Studio 2022 version 17.8, you can use any applicable tool in the Performance Profiler to help improve your code, and not just the Instrumentation tool. You can profile small units of work in isolation, make changes, and then remeasure and validate the impact of the changes.
37
37
38
38
To diagnose why a test method is taking more time than you'd like, or using more memory than you'd like:
39
39
40
-
1.Select the method in Test Explorer, right-click on the pane, and then select **Profile**.
40
+
1.Right-click the method in Test Explorer, and then select **Profile**.
41
41
1. In the Performance Profiler, select a profiling tool to test your code.
42
42
43
43
For more information, see [this blog post](https://devblogs.microsoft.com/visualstudio/a-unit-of-profiling-makes-the-allocations-go-away/) or see [Collect profiling data without debugging](../profiling/running-profiling-tools-with-or-without-the-debugger.md#collect-profiling-data-without-debugging).
@@ -46,7 +46,7 @@ For more information, see [this blog post](https://devblogs.microsoft.com/visual
46
46
::: moniker range="vs-2019"
47
47
To diagnose why a test method is taking too much time:
48
48
49
-
-Select the method in Test Explorer, right-click on the pane, and then select **Profile**.
49
+
-Right-click the method in Test Explorer, and then select **Profile**.
50
50
51
51
For more information, see [Instrumentation profiling report](../profiling/understanding-instrumentation-data-values.md?view=vs-2017&preserve-view=true).
52
52
@@ -58,17 +58,17 @@ For more information, see [Instrumentation profiling report](../profiling/unders
58
58
59
59
## Get AI assistance to debug tests
60
60
61
-
Starting in Visual Studio 2022 version 17.12 Preview 2, you can get quick assistance from GitHub Copilot to debug tests if you have an [active Copilot subscription](../ide/visual-studio-github-copilot-chat.md#prerequisites). To get help, right-click a failed test in Test Explorer, and then do one of the following:
61
+
Starting in Visual Studio 2022 version 17.12 Preview 2, you can get quick assistance from GitHub Copilot to debug tests if you have an [active Copilot subscription](../ide/visual-studio-github-copilot-chat.md#prerequisites). To get help, right-click a failed test in Test Explorer, and then select of the following commands:
62
62
63
-
-Select **Explain failure with Copilot**.
64
-
-Select **Debug with Copilot**.
63
+
-**Explain failure with Copilot**
64
+
-**Debug with Copilot**
65
65
66
66

67
67
68
68
If you debug with GitHub Copilot:
69
69
70
70
1. It provides you with a debug plan.
71
-
1. It sets appropriate breakpoints and watch variables
71
+
1. It sets appropriate breakpoints and watch variables.
72
72
1. It starts the debug session.
73
73
74
74
When the debugger hits the breakpoint, it provides GitHub Copilot with values for the watched variables. Copilot then determines your next step: either continue debugging or fix the problem code. You can continue the Copilot Chat conversation until you have a passing test.
title: Review Test Explorer FAQ issues and answers
2
+
title: Review Test Explorer FAQ Issues and Answers
3
3
description: Review frequently asked questions (FAQs) about Visual Studio Test Explorer, which include some common troubleshooting scenarios.
4
4
ms.date: 06/25/2020
5
5
ms.topic: conceptual
@@ -19,109 +19,117 @@ ms.subservice: test-tools
19
19
20
20
## Dynamic test discovery
21
21
22
-
**Test Explorer is not discovering my tests that are dynamically defined. (For example, theories, custom adapters, custom traits, #ifdefs, etc.) How can I discover these tests?**
22
+
**Test Explorer is not discovering my tests that are dynamically defined (for example, theories, custom adapters, custom traits, and #ifdef statements). How can I discover these tests?**
23
23
24
24
Build your project to run assembly-based discovery.
25
25
26
-
[Real-time test discovery](https://devblogs.microsoft.com/dotnet/real-time-test-discovery/) is source-based test discovery. It can’t discover tests that use theories, custom adapters, custom traits, `#ifdef` statements, and more because they're defined at run time. A build is required for those tests to be accurately found. In Visual Studio 2017 version 15.6 and later, assembly-based discovery (the traditional discoverer) runs only after builds. This setting means real-time test discovery finds as many tests as it can while you're editing, and assembly-based discovery allows dynamically defined tests to appear after a build. Real-time test discovery improves responsiveness, but still allows you to get complete and precise results after a build.
26
+
[Real-time test discovery](https://devblogs.microsoft.com/dotnet/real-time-test-discovery/) is source-based test discovery. It can't discover tests that use theories, custom adapters, custom traits, `#ifdef` statements, and more because they're defined at runtime. A build is required for those tests to be accurately found.
27
27
28
-
## Test Explorer '+' (plus) symbol
28
+
In Visual Studio 2017 version 15.6 and later, assembly-based discovery (the traditional discoverer) runs only after builds. This setting means real-time test discovery finds as many tests as it can while you're editing. Assembly-based discovery allows dynamically defined tests to appear after a build.
29
29
30
-
**What does the '+' (plus) symbol that appears in the top line of Test Explorer mean?**
30
+
Real-time test discovery improves responsiveness, but it still allows you to get complete and precise results after a build.
31
31
32
-
The '+' (plus) symbol indicates that more tests may be discovered after a build when assembly-based discovery runs. This symbol appears if dynamically defined tests are detected in your project.
32
+
## Test Explorer plus (+) symbol
33
33
34
-

34
+
**What does the plus symbol that appears in the top line of Test Explorer mean?**
35
+
36
+
The plus (+) symbol indicates that more tests might be discovered after a build when assembly-based discovery runs. This symbol appears if dynamically defined tests are detected in your project.
37
+
38
+

35
39
36
40
## Real-time test discovery
37
41
38
-
**Tests now appear in Test Explorer while I type, without having to build my project. What changed?**
42
+
**Tests now appear in Test Explorer while I type, without requiring me to build my project. What changed?**
39
43
40
-
This feature is called [Real-time test discovery](https://devblogs.microsoft.com/dotnet/real-time-test-discovery/). It uses a Roslyn analyzer to find tests and populate Test Explorer in real time, without requiring you to build your project. For more information about test discovery behavior for dynamically defined tests such as theories or custom traits, see [Dynamic test discovery](#dynamic-test-discovery).
44
+
This feature is called [real-time test discovery](https://devblogs.microsoft.com/dotnet/real-time-test-discovery/). It uses a Roslyn analyzer to find tests and populate Test Explorer in real time, without requiring you to build your project. For more information about test discovery behavior for dynamically defined tests such as theories or custom traits, see [Dynamic test discovery](#dynamic-test-discovery) earlier in this article.
41
45
42
-
## Real-time test discovery compatibility
46
+
## Compatibility for real-time test discovery
43
47
44
-
**What languages and test frameworks can use Real Time Test Discovery?**
48
+
**What languages and test frameworks can use real-time test discovery?**
45
49
46
-
[Real-time test discovery](https://devblogs.microsoft.com/dotnet/real-time-test-discovery/)only works for the managed languages (C# and Visual Basic), since it's built using the Roslyn compiler. For now, real-time test discovery only works for the xUnit, NUnit, and MSTest frameworks.
50
+
[Real-time test discovery](https://devblogs.microsoft.com/dotnet/real-time-test-discovery/) works only for the managed languages (C# and Visual Basic), because it's built via the Roslyn compiler. For now, real-time test discovery works only for the xUnit, NUnit, and MSTest frameworks.
47
51
48
52
## Test Explorer logs
49
53
50
-
**How can I turn on logs for the Test Explorer?**
54
+
**How can I turn on logs for Test Explorer?**
51
55
52
-
Navigate to **Tools** > **Options** > **Test** and find the Logging section there.
56
+
Go to **Tools** > **Options** > **Test** and find the **Logging** section there.
53
57
54
58
## UWP test discovery
55
59
56
60
**Why are my tests in UWP projects not discovered until I deploy my app?**
57
61
58
-
UWP tests target a different runtime when the app is deployed. This means that to find tests accurately for UWP projects you not only need to build your project, but also deploy.
62
+
Universal Windows Platform (UWP) tests target a different runtime when the app is deployed. To find tests accurately for UWP projects, you need to not only build your project but also deploy it.
59
63
60
64
## Test Explorer sorting
61
65
62
66
**How does sorting test results work in the hierarchy view?**
63
67
64
-
The hierarchy view sorts tests alphabetically as opposed to by outcome. Previous groupby settings sorted test results by outcome and then alphabetically. You can still enable sorting by outcome by right-clicking on the column header in Test Explorer, enabling the State column, and then clicking on the State column header to apply sorting on that column. You can provide feedback about the design in this [GitHub issue](https://github.com/Microsoft/vstest/issues/1425).
68
+
The hierarchy view sorts tests alphabetically, not by outcome. Previous group-by settings sorted test results by outcome and then alphabetically. You can still enable sorting by outcome by right-clicking the column header in Test Explorer, enabling the **State** column, and then selecting the **State** column header to apply sorting on that column. You can provide feedback about the design in [this GitHub issue](https://github.com/Microsoft/vstest/issues/1425).
65
69
66
70
## Test Explorer hierarchy view
67
71
68
-
**In the hierarchy view, there are passed, failed, skipped, and notrun icons next to parent-node groupings. What do these icons mean?**
72
+
**In the hierarchy view, there are passed, failed, skipped, and not-run icons next to parent-node groupings. What do these icons mean?**
69
73
70
-
The icons next to the Project, Namespace, and Class groupings show the state of the tests within that grouping. See the following table.
74
+
The icons next to the **Project**, **Namespace**, and **Class** groupings show the state of the tests within that grouping. See the following table.
71
75
72
-

76
+

73
77
74
78
## Search by file path
75
79
76
-
**There is no longer a "File Path" filter in the Test Explorer search box.**
80
+
**Why is there is no longer a file path filter in the Test Explorer search box?**
77
81
78
-
The file path filter in the **Test Explorer** search box was removed in Visual Studio 2017 version 15.7. This feature had low usage, and Test Explorer can retrieve test methods faster by leaving out this feature. If this change interrupts your development flow, let us know by submitting feedback on [Developer Community](https://aka.ms/feedback/suggest?space=8).
82
+
The file path filter in the Test Explorer search box was removed in Visual Studio 2017 version 15.7. This feature had low usage, and Test Explorer can retrieve test methods faster by leaving it out. If this change interrupts your development flow, let us know by submitting feedback on [Developer Community](https://aka.ms/feedback/suggest?space=8).
79
83
80
-
## Remove undocumented interfaces
84
+
## Removal of undocumented interfaces
81
85
82
86
**Some test-related APIs are no longer present in Visual Studio 2019. What changed?**
83
87
84
-
In Visual Studio 2019, some test window APIs that were previously marked public but were never officially documented will be removed. They were marked as "deprecated" in Visual Studio 2017 to give extension maintainers an early warning. To our knowledge, very few extensions had found these APIs and taken a dependency on them. These include `IGroupByProvider`, `IGroupByProvider<T>`, `KeyComparer`, `ISearchFilter`, `ISearchFilterToken`, `ISearchToken`, and `SearchFilterTokenType`. If this change affects your extension, let us know by filing a bug on [Developer Community](https://aka.ms/feedback/suggest?space=8).
88
+
In Visual Studio 2019, some test window APIs that were previously marked public but were never officially documented were removed. They were marked as deprecated in Visual Studio 2017 to give extension maintainers an early warning. To our knowledge, very few extensions found these APIs and took a dependency on them. They include `IGroupByProvider`, `IGroupByProvider<T>`, `KeyComparer`, `ISearchFilter`, `ISearchFilterToken`, `ISearchToken`, and `SearchFilterTokenType`.
89
+
90
+
If this change affects your extension, let us know by filing a bug on [Developer Community](https://aka.ms/feedback/suggest?space=8).
85
91
86
92
## Test adapter NuGet reference
87
93
88
-
**In Visual Studio 2017 version 15.8 my tests are discovered, but don't execute.**
94
+
**Why don't my tests run in Visual Studio 2017 version 15.8, even though they're discovered?**
89
95
90
-
All test projects must include their .NET test adapter NuGet reference in their .csproj file. If they don't, the following test output appears on the project if discovery by a test adapter extension is kicked off after a build, or if the user tries to run the selected tests:
96
+
All test projects must include their .NET test adapter NuGet reference in their .csproj file. If they don't, the following test output appears on the project if discovery by a test adapter extension starts after a build, or if the user tries to run the selected tests:
91
97
92
98
**Test project {} does not reference any .NET NuGet adapter. Test discovery or execution might not work for this project. It is recommended to reference NuGet test adapters in each .NET test project in the solution.**
93
99
94
-
Instead of using test adapter extensions, projects are required to use test adapter NuGet packages. This requirement greatly improves performance and causes fewer issues with continuous integration. Read more about .NET Test Adapter Extension deprecation in the [release notes](/visualstudio/releasenotes/vs2017-relnotes-v15.8#testadapterextension).
100
+
Instead of using test adapter extensions, projects are required to use test adapter NuGet packages. This requirement greatly improves performance and causes fewer problems with continuous integration. Read more about the deprecation of .NET test adapter extensions in the [release notes](/visualstudio/releasenotes/vs2017-relnotes-v15.8#testadapterextension).
95
101
96
-
## UWP TestContainer was not found
102
+
## UWP TestContainer not found
97
103
98
-
**My UWP tests are no longer being executed in Visual Studio 2017 version 15.7 and later.**
104
+
**Why are my UWP tests no longer running in Visual Studio 2017 version 15.7 and later?**
99
105
100
-
Recent UWP test projects specify a test platform build property that allows better performance for identifying test apps. If you have a UWP test project that was initialized before Visual Studio version 15.7, you may see this error in **Output** > **Tests**:
106
+
Recent UWP test projects specify a build property that allows better performance for identifying test apps. If you have a UWP test project that was initialized before Visual Studio version 15.7, you might see this error in **Output** > **Tests**:
101
107
102
108
**System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: The following TestContainer was not found {} at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider \<GetTestContainerAsync>d__61.MoveNext()**
103
109
104
110
To fix this error:
105
111
106
-
- Update your test project build property using the following code:
112
+
- Update the build property for your test projects by using the following code:
0 commit comments