Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>MsTest SnippetsNew to Visual Studio Code? Get it now.
MsTest Snippets

MsTest Snippets

davidpetersmke

|
2,449 installs
| (1) | Free
A collection of snippets to help writing MSTest tests. Includes test method, test class, test initialize, and test cleanup.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Features

  • Test Class
  • Test Initialize
  • Test Method
  • Test Cleanup

The Class, Initialize, and Cleanup snippets use the current filename to name the symbol.

Example:

In a file called "FindAccountTests.cs" it will produce:

[TestClass]
public class FindAccountTests 
{

}
[TestInitialize]
public void InitializeFindAccountTests()
{
    
}
[TestCleanup]
public void CleanupFindAccountTests()
{
    
}

The testmethod snippet simply emits a test method with a dummy name, but it is the first tab stop so you just keep typing.

[TestMethod]
public void MyTestMethod()
{
    
}

In all cases the second tab stop is within the symbol body.

Release Notes

0.0.5

Made display name more searchable.

0.0.4

Initial release for testing via the marketplace. Includes 4 snippets.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft