-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more links to MSTest api docs #44716
base: main
Are you sure you want to change the base?
Conversation
docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
Outdated
Show resolved
Hide resolved
Adding @gewarren Do you know why the xrefs are generating warnings here? |
docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Youssef Victor <[email protected]>
BTW, we have an extension for VS Code that inserts xrefs links. Do you know about it? It's a very helpful tool. https://github.com/IEvangelist/xref-helper/blob/main/README.md |
I wasn't aware of it! |
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-attributes.md
Outdated
Show resolved
Hide resolved
docs/core/testing/unit-testing-mstest-writing-tests-testcontext.md
Outdated
Show resolved
Hide resolved
@@ -81,4 +81,4 @@ The <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.AddResultFile | |||
|
|||
:::code language="csharp" source="snippets/testcontext/csharp/AddResultFile.cs"::: | |||
|
|||
You can also use `TestContext.Write` or `TestContext.WriteLine` methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. | |||
You can also use <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.Write> or <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine> methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.Write> or <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine> methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. | |
You can also use <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.Write*> or <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine*> methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. |
Co-authored-by: Youssef Victor <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments - but these are only suggestions that you can decide for yourself about.
@@ -29,7 +29,7 @@ Every test class must have the `TestClass` attribute, and every test method must | |||
|
|||
### `TestClassAttribute` | |||
|
|||
The [TestClass](<xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute>) attribute marks a class that contains tests and, optionally, initialize or cleanup methods. | |||
The <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute> attribute marks a class that contains tests and, optionally, initialize or cleanup methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually prefer the original display here. It still uses an xref and the word "attribute" isn't repeated. (When you use an xref like that (with custom text), you don't actually need the angle brackets.)
|
||
The method should be an instance `public` method defined as `void`, `Task`, or `ValueTask` (starting with MSTest v3.3). It can optionally be `async` but should not be `async void`. | ||
|
||
The method should have zero parameters, unless it's used with `[DataRow]`, `[DynamicData]` or similar attribute that provides test case data to the test method. | ||
The method should have zero parameters, unless it's used with <xref:Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute>, <xref:Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataAttribute> or similar attribute that provides test case data to the test method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method should have zero parameters, unless it's used with <xref:Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute>, <xref:Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataAttribute> or similar attribute that provides test case data to the test method. | |
The method should have zero parameters, unless it's marked with <xref:Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute>, <xref:Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataAttribute>, or a similar attribute that provides test case data to the test method. |
|
||
It's possible to control the inheritance behavior: only for current class using `InheritanceBehavior.None` or for all derived classes using `InheritanceBehavior.BeforeEachDerivedClass`. | ||
It's possible to control the inheritance behavior: only for current class using [InheritanceBehavior.None](<xref:Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior>) or for all derived classes using [InheritanceBehavior.BeforeEachDerivedClass](<xref:Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior>). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to control the inheritance behavior: only for current class using [InheritanceBehavior.None](<xref:Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior>) or for all derived classes using [InheritanceBehavior.BeforeEachDerivedClass](<xref:Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior>). | |
It's possible to control the inheritance behavior: only for current class using <xref:Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior.None?displayProperty=nameWithType>, or for all derived classes using <xref:Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior.BeforeEachDerivedClass?displayProperty=nameWithType>. |
- `TestContext.TestData` - the data that will be provided to the parameterized test method or `null` if the test is not parameterized. | ||
- `TestContext.TestDisplayName` - the display name of the test method. | ||
- `TestContext.TestException` - the exception thrown by either the test method or test initialize, or `null` if the test method did not throw an exception. | ||
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestData> - the data that will be provided to the parameterized test method or `null` if the test is not parameterized. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestData> - the data that will be provided to the parameterized test method or `null` if the test is not parameterized. | |
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestData?displayProperty=nameWithType> - the data that will be provided to the parameterized test method, or `null` if the test is not parameterized. |
- `TestContext.TestDisplayName` - the display name of the test method. | ||
- `TestContext.TestException` - the exception thrown by either the test method or test initialize, or `null` if the test method did not throw an exception. | ||
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestData> - the data that will be provided to the parameterized test method or `null` if the test is not parameterized. | ||
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestDisplayName> - the display name of the test method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestDisplayName> - the display name of the test method. | |
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestDisplayName?displayProperty=nameWithType> - the display name of the test method. |
- `TestContext.TestException` - the exception thrown by either the test method or test initialize, or `null` if the test method did not throw an exception. | ||
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestData> - the data that will be provided to the parameterized test method or `null` if the test is not parameterized. | ||
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestDisplayName> - the display name of the test method. | ||
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestException> - the exception thrown by either the test method or test initialize, or `null` if the test method did not throw an exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestException> - the exception thrown by either the test method or test initialize, or `null` if the test method did not throw an exception. | |
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestException?displayProperty=nameWithType> - the exception thrown by either the test method or test initialize, or `null` if the test method did not throw an exception. |
@@ -81,4 +81,4 @@ The <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.AddResultFile | |||
|
|||
:::code language="csharp" source="snippets/testcontext/csharp/AddResultFile.cs"::: | |||
|
|||
You can also use `TestContext.Write` or `TestContext.WriteLine` methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. | |||
You can also use <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.Write*> or <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine*> methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.Write*> or <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine*> methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. | |
You can also use <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.Write*?displayProperty=nameWithType> or <xref:Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.WriteLine*?displayProperty=nameWithType> methods to write custom messages directly to the test output. This is especially useful for debugging purposes, as it provides real-time logging information within your test execution context. |
Summary
Describe your changes here.
Fixes #Issue_Number (if available)
Internal previews
TestContext
class