Skip to content

Commit 6fc8ac5

Browse files
authored
Merge pull request #7870 from MicrosoftDocs/main637847967251802398
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 7691036 + d9cab66 commit 6fc8ac5

38 files changed

+198
-28
lines changed
40.2 KB
Loading
Loading
Loading
9.33 KB
Loading
Loading
8.66 KB
Loading
9.96 KB
Loading
-6.53 KB
Binary file not shown.

docs/debugger/watch-and-quickwatch-windows.md

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Set a watch on variables | Microsoft Docs
33
description: While you debug, see variables and expressions in Watch and QuickWatch. Watch can display several variables, QuickWatch only one, and only while in break.
44
ms.custom: SEO-VS-2020
5-
ms.date: 09/10/2021
5+
ms.date: 04/04/2022
66
ms.topic: how-to
77
f1_keywords:
88
- "vs.debug.quickwatch"
@@ -66,7 +66,17 @@ int main()
6666

6767
1. In the **Watch** window, select an empty row, and type variable `a`. Do the same for `b` and `c`.
6868

69-
![Watch variables](../debugger/media/watchvariables.png "WatchVariables")
69+
::: moniker range="<=vs-2019"
70+
71+
![Screenshot of Watch variables.](../debugger/media/vs-2019/watch-variable.png)
72+
73+
::: moniker-end
74+
75+
::: moniker range=">=vs-2022"
76+
77+
![Screenshot of Watch variables.](../debugger/media/vs-2022/watch-variable.png)
78+
79+
::: moniker-end
7080

7181
1. Continue debugging by selecting **Debug** > **Step Into** or pressing **F11** as needed to advance. The variable values in the **Watch** window change as you iterate through the `for` loop.
7282

@@ -82,22 +92,43 @@ You can observe any valid expression recognized by the debugger in a **Watch** w
8292

8393
For example, for the code in the preceding section, you can get the average of the three values by entering `(a + b + c) / 3` in the **Watch** window:
8494

85-
![Watch expression](../debugger/media/watchexpression.png "Watch expression")
95+
::: moniker range="<=vs-2019"
96+
97+
![Screenshot of Watch expression.](../debugger/media/vs-2019/watch-expression.png "Watch expression")
98+
99+
::: moniker-end
100+
101+
::: moniker range=">=vs-2022"
102+
103+
![Screenshot of Watch expression.](../debugger/media/vs-2022/watch-expression.png "Watch expression")
104+
105+
::: moniker-end
86106

87107
The rules for evaluating expressions in the **Watch** window are generally the same as the rules for evaluating expressions in the code language. If an expression has a syntax error, expect the same compiler error as in the code editor. For example, a typo in the preceding expression produces this error in the **Watch** window:
88108

89-
![Watch expression error](../debugger/media/watchexpressionerror.png "Watch expression error")
109+
::: moniker range="<=vs-2019"
110+
111+
![Screenshot of Watch expression error.](../debugger/media/vs-2019/watch-expression-error.png "Watch expression error")
112+
113+
::: moniker-end
114+
115+
::: moniker range=">=vs-2022"
116+
117+
![Screenshot of Watch expression error.](../debugger/media/vs-2022/watch-expression-error.png "Watch expression error")
118+
119+
::: moniker-end
90120

91121
A circle with two wavy lines icon may appear in the **Watch** window. This icon means the debugger doesn't evaluate the expression because of a potential cross-thread dependency. Evaluating the code requires other threads in your app to run temporarily, but since you are in break mode, all threads in your app are usually stopped. Allowing other threads to run temporarily can have unexpected effects on the state of your app, and the debugger may ignore events such as breakpoints and exceptions on those threads.
92122

93123
::: moniker range=">= vs-2019"
124+
94125
## Search in the Watch window
95126

96127
You can search for keywords in the Name, Value, and Type columns of the **Watch** window using the search bar above each window. Hit ENTER or select one of the arrows to execute a search. To cancel an ongoing search, select the "x" icon in the search bar.
97128

98129
Use the left and right arrows (Shift+F3 and F3, respectively) to navigate between found matches.
99130

100-
![Search in Watch Window](../debugger/media/ee-search-watch.png "Search in Watch Window")
131+
![Screenshot of Search in Watch Window.](../debugger/media/ee-search-watch.png "Search in Watch Window")
101132

102133
To make your search more or less thorough, use the **Search Deeper** dropdown at the top of the **Watch** window to select how many levels deep you want to search into nested objects.
103134

@@ -108,7 +139,7 @@ To make your search more or less thorough, use the **Search Deeper** dropdown at
108139
109140
You can quickly inspect objects by their properties in the Watch window with the **Pinnable Properties** tool. To use this tool, hover over a property and select the pin icon that appears or right-click and select the **Pin Member as Favorite** option in the resulting context menu. This bubbles up that property to the top of the object’s property list, and the property name and value is displayed in the **Value** column. To unpin a property, select the pin icon again or select the **Unpin Member as Favorite** option in the context menu.
110141

111-
![Pin properties in the Watch window](../debugger/media/basic-pin-watch.gif "Pin properties in the Watch window")
142+
![Screenshot of Pin properties in the Watch window.](../debugger/media/basic-pin-watch.gif "Pin properties in the Watch window")
112143

113144
You can also toggle property names and filter out non-pinned properties when viewing the object’s property list in the Watch window. You can access both options by selecting the buttons in the toolbar above the watch window.
114145

@@ -147,7 +178,17 @@ To demonstrate using the refresh icon:
147178

148179
1. Start debugging. The **Watch** window shows something like the following message:
149180

150-
![Refresh Watch](../debugger/media/refreshwatch.png "Refresh Watch")
181+
::: moniker range="<=vs-2019"
182+
183+
![Screenshot of Refresh Watch.](../debugger/media/vs-2019/refresh-watch.png "Refresh Watch")
184+
185+
::: moniker-end
186+
187+
::: moniker range=">=vs-2022"
188+
189+
![Screenshot of Refresh Watch.](../debugger/media/vs-2022/refresh-watch.png "Refresh Watch")
190+
191+
::: moniker-end
151192

152193
1. To refresh the value, select the refresh icon, or press the spacebar. The debugger reevaluates the expression.
153194

@@ -288,11 +329,31 @@ To observe the `a` variable,
288329

289330
The **QuickWatch** dialog appears. The `a` variable is in the **Expression** box with a **Value** of **1**.
290331

291-
![QuickWatch variable](../debugger/media/quickwatchvariable.png "QuickWatch variable")
332+
::: moniker range="<=vs-2019"
333+
334+
![Screenshot of QuickWatch variable.](../debugger/media/vs-2019/quickwatch-variable.png "QuickWatch variable")
335+
336+
::: moniker-end
337+
338+
::: moniker range=">=vs-2022"
339+
340+
![Screenshot of QuickWatch variable.](../debugger/media/vs-2022/quickwatch-variable.png "QuickWatch variable")
341+
342+
::: moniker-end
292343

293344
1. To evaluate an expression using the variable, type an expression such as `a + b` in the **Expression** box, and select **Reevaluate**.
294345

295-
![QuickWatch expression](../debugger/media/quickwatchexpression.png "QuickWatch expression")
346+
::: moniker range="<=vs-2019"
347+
348+
![Screenshot of QuickWatch expression.](../debugger/media/vs-2019/quickwatch-expression.png "QuickWatch expression")
349+
350+
::: moniker-end
351+
352+
::: moniker range=">=vs-2022"
353+
354+
![Screenshot of QuickWatch expression.](../debugger/media/vs-2022/quickwatch-expression.png "QuickWatch expression")
355+
356+
::: moniker-end
296357

297358
1. To add the variable or expression from **QuickWatch** to the **Watch** window, select **Add Watch**.
298359

docs/test/generate-unit-tests-for-your-code-with-intellitest.md

Lines changed: 122 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Generate unit tests for your code with IntelliTest
33
description: IntelliTest explores your .NET code to generate test data and a suite of unit tests. Learn how to run IntelliTest to generate smart fuzz tests that cover all your logic branches, see which tests are failing, and fix them.
44
ms.custom: SEO-VS-2020
5-
ms.date: 10/05/2015
5+
ms.date: 04/04/2022
66
ms.topic: conceptual
77
f1_keywords:
88
- vs.UnitTest.CreateIntelliTest
@@ -39,27 +39,77 @@ To generate unit tests, your types must be public.
3939

4040
2. Right-click on a method and choose **Run IntelliTest** to generate unit tests for the code in your method.
4141

42-
![Right&#45;click in your method to generate unit tests](../test/media/runpex.png)
42+
::: moniker range="<=vs-2019"
43+
44+
![Screenshot of right click on method to generate unit tests.](../test/media/vs-2019/run-pex.png)
45+
46+
::: moniker-end
47+
48+
::: moniker range=">=vs-2022"
49+
50+
![Screenshot of right click on method to generate unit tests.](../test/media/vs-2022/run-pex.png)
51+
52+
::: moniker-end
4353

4454
IntelliTest runs your code many times with different inputs. Each run is represented in the table showing the input test data and the resulting output or exception.
4555

46-
![Exploration Results window is displayed with tests](../test/media/pexexplorationresults.png)
56+
::: moniker range="<=vs-2019"
57+
58+
![Screenshot of Exploration Results window.](../test/media/vs-2019/pex-exploration-results.png)
59+
60+
::: moniker-end
61+
62+
::: moniker range=">=vs-2022"
63+
64+
![Screenshot of Exploration Results window.](../test/media/vs-2022/pex-exploration-results.png)
65+
66+
::: moniker-end
4767

4868
To generate unit tests for all the public methods in a class, simply right-click in the class rather than a specific method, and then choose **Run IntelliTest**. Use the drop-down list in the **Exploration Results** window to display the unit tests and the input data for each method in the class.
4969

50-
![Select the test results to view from the list](../test/media/selectpextest.png)
70+
::: moniker range="<=vs-2019"
71+
72+
![Screenshot of test results to view from list.](../test/media/vs-2019/select-pex-test.png)
73+
74+
::: moniker-end
75+
76+
::: moniker range=">=vs-2022"
77+
78+
![Screenshot of test results to view from list.](../test/media/vs-2022/select-pex-test.png)
79+
80+
::: moniker-end
5181

5282
For tests that pass, check that the reported results in the result column match your expectations for your code. For tests that fail, fix your code as appropriate. Then rerun IntelliTest to validate the fixes.
5383

5484
## Persist: Save the unit tests as a regression suite
5585

5686
1. Select the data rows that you want to save with the parameterized unit test into a test project.
5787

58-
![Select tests; right&#45;click and choose Save](../test/media/savepextests.png)
88+
::: moniker range="<=vs-2019"
89+
90+
![Screenshot of Save test results.](../test/media/vs-2019/save-pex-tests.png)
91+
92+
::: moniker-end
93+
94+
::: moniker range=">=vs-2022"
95+
96+
![Screenshot of Save test results.](../test/media/vs-2022/save-pex-tests.png)
97+
98+
::: moniker-end
5999

60100
You can view the test project and the parameterized unit test that has been created - the individual unit tests, corresponding to each of the rows, are saved in the *.g.cs* file in the test project, and a parameterized unit test is saved in its corresponding *.cs* file. You can run the unit tests and view the results from Test Explorer just as you would for any unit tests that you created manually.
61101

62-
![Open class file in test method to view unit test](../test/media/testmethodpex.png)
102+
::: moniker range="<=vs-2019"
103+
104+
![Screenshot of saved tests in Solution Explorer.](../test/media/vs-2019/test-method-pex.png)
105+
106+
::: moniker-end
107+
108+
::: moniker range=">=vs-2022"
109+
110+
![Screenshot of saved tests in Solution Explorer.](../test/media/vs-2022/test-method-pex.png)
111+
112+
::: moniker-end
63113

64114
Any necessary references are also added to the test project.
65115

@@ -71,19 +121,49 @@ For tests that pass, check that the reported results in the result column match
71121

72122
View the warnings to decide what you want to do.
73123

74-
![View warnings](../test/media/pexviewwarning.png)
124+
::: moniker range="<=vs-2019"
125+
126+
![Screenshot of View warnings.](../test/media/vs-2019/pex-view-warning.png)
127+
128+
::: moniker-end
129+
130+
::: moniker range=">=vs-2022"
131+
132+
![Screenshot of View warnings.](../test/media/vs-2022/pex-view-warning.png)
133+
134+
::: moniker-end
75135

76136
2. After you investigate the code and understand what you want to test, you can fix the warning to choose which classes to use to test the interface.
77137

78-
![Right&#45;click the warning and choose Fix](../test/media/pexfixwarning.png)
138+
::: moniker range="<=vs-2019"
139+
140+
![Screenshot of Fix warning.](../test/media/vs-2019/pex-fix-warning.png)
141+
142+
::: moniker-end
143+
144+
::: moniker range=">=vs-2022"
145+
146+
![Screenshot of Fix warning.](../test/media/vs-2022/pex-fix-warning.png)
147+
148+
::: moniker-end
79149

80150
This choice is added into the *PexAssemblyInfo.cs* file.
81151

82152
`[assembly: PexUseType(typeof(Camera))]`
83153

84154
3. Now you can rerun IntelliTest to generate a parameterized unit test and test data just using the class that you fixed.
85155

86-
![Rerun IntelliTest to generate the test data](../test/media/pexwarningsfixed.png)
156+
::: moniker range="<=vs-2019"
157+
158+
![Screenshot of Rerun IntelliTest after fix.](../test/media/vs-2019/pex-warnings-fixed.png)
159+
160+
::: moniker-end
161+
162+
::: moniker range=">=vs-2022"
163+
164+
![Screenshot of Rerun IntelliTest after fix.](../test/media/vs-2022/pex-warnings-fixed.png)
165+
166+
::: moniker-end
87167

88168
## Specify: Use IntelliTest to validate correctness properties that you specify in code
89169

@@ -129,11 +209,31 @@ If you add an assertion and rerun IntelliTest, it will check that your assertion
129209

130210
**A:** Yes, right-click in the class or method, then choose **Create IntelliTest**.
131211

132-
![Right&#45;click editor, choose Create IntelliTest](../test/media/pexcreateintellitest.png)
212+
::: moniker range="<=vs-2019"
213+
214+
![Screenshot of Create IntelliTest.](../test/media/vs-2019/pex-create-intellitest.png)
215+
216+
::: moniker-end
217+
218+
::: moniker range=">=vs-2022"
219+
220+
![Screenshot of Create IntelliTest.](../test/media/vs-2022/pex-create-intellitest.png)
221+
222+
::: moniker-end
133223

134224
Accept the default format to generate your tests, or change how your project and tests are named. You can create a new test project or save your tests to an existing project.
135225

136-
![Create IntelliTest with MSTest default](../test/media/pexcreateintellitestmstest.png)
226+
::: moniker range="<=vs-2019"
227+
228+
![Screenshot of Create IntelliTest with MSTest default.](../test/media/vs-2019/pex-create-intellitest-mstest.png)
229+
230+
::: moniker-end
231+
232+
::: moniker range=">=vs-2022"
233+
234+
![Screenshot of Create IntelliTest with MSTest default.](../test/media/vs-2022/pex-create-intellitest-mstest.png)
235+
236+
::: moniker-end
137237

138238
<a name="extend-framework"></a>
139239
### Q: Can I use other unit test frameworks with IntelliTest?
@@ -143,7 +243,17 @@ Test framework extensions are also available in Visual Studio Marketplace, for e
143243

144244
After you restart Visual Studio and reopen your solution, right-click in the class or method, then choose **Create IntelliTest**. Select your installed framework here:
145245

146-
![Select other unit test framework for IntelliTest](../test/media/pexcreateintellitestextensions.png)
246+
::: moniker range="<=vs-2019"
247+
248+
![Screenshot of Select other unit test framework for IntelliTest.](../test/media/vs-2019/pex-create-intellitest-extensions.png)
249+
250+
::: moniker-end
251+
252+
::: moniker range=">=vs-2022"
253+
254+
![Screenshot of Select other unit test framework for IntelliTest.](../test/media/vs-2022/pex-create-intellitest-extensions.png)
255+
256+
::: moniker-end
147257

148258
Then run IntelliTest to generate individual unit tests in their corresponding *.g.cs* files.
149259

File renamed without changes.
Loading
Loading
Loading
Loading
13.6 KB
Loading
13.7 KB
Loading
14.6 KB
Loading

docs/test/media/vs-2022/run-pex.png

53.5 KB
Loading
17.9 KB
Loading
16.5 KB
Loading
20.6 KB
Loading

0 commit comments

Comments
 (0)