MSTest

MSTest

MSTest is a software unit testing framework developed by Microsoft, which integrates closely with Visual Studio. MSTest lets you create, manage and run unit tests from within the Visual Studio IDE, as well as externally, from the command line.

MSTest Design

The MSTest framework has a design that is familiar to those who have worked with NUnit in the past.

Test Class

Test classes are declared as such by decorating a class with the [http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testclassattribute(VS.80).aspx TestClass attribute] . The attribute is used to identify classes that contain test methods. Best practices state that test classes should contain only unit test code.

Test Method

Test methods are declared as such by decorating a unit test method with the [http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testmethodattribute(VS.80).aspx TestMethod attribute] . The attribute is used to identify methods that contain unit test code. Best practices state that unit test methods should contain only unit test code.

Assertions

An assertion is a piece of code that is run to test a condition or behavior against an expected result. Assertions in MSTest are executed by calling methods in the [http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.assert(VS.80).aspx Assert class] .

Initialization and Cleanup Methods

Initialization and cleanup methods are used to prepare unit tests before running and cleaning up after unit tests have been executed. Initialization methods are declared as such by decorating an initialization method with the [http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testinitializeattribute(VS.80).aspx TestInitialize attribute] , while cleanup methods are declared as such by decorating a cleanup method with the [http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testcleanupattribute(VS.80).aspx TestCleanup attribute] .

ample Test

Below is a very basic sample unit test: [TestClass()] public class TestClass{ [TestMethod()] public void MyTest() { Assert.IsTrue(true);

ee Also

*Software Testing
*Unit Testing
*Test Driven Development
*NUnit
*List of Unit Testing Frameworks

External links

* [http://msdn.microsoft.com/en-us/library/ms379625(VS.80).aspx A Unit Testing Walkthrough with Visual Studio Team Test]
* [http://weblogs.asp.net/rosherove/archive/2008/01/17/the-evolution-of-unit-testing-and-syntax.aspx The evolution of Unit Testing Syntax and Semantics]
* [http://www.xprogramming.com/testfram.htm Kent Beck's original testing framework paper]
* [http://The.ArtOfUnitTesting.com/ Roy Osherove's book excerpts on Unit Testing: The Art Of Unit Testing]
* [http://www.softdevarticles.com/modules/weblinks/viewcat.php?cid=34 List of articles on unit testing]
* [http://shebanation.com/2007/08/21/a-brief-history-of-test-frameworks/ History of unit test frameworks (Andrew Shebanow)]
* [http://www.parasoft.com/jsp/redirector.jsp/WWH_UnitTesting_W Why, When, How: Unit Testing white paper (Adam Kolawa)]
* [http://geosoft.no/development/unittesting.html Unit Testing Guidelines from GeoSoft]
* [http://c2.com/cgi/wiki?TestDrivenDevelopment Test Driven Development (Ward Cunningham's Wiki)]


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • ReSharper — Тип дополнение для Visual Studio Разработчик JetBrai …   Википедия

  • CodeRush — For other uses, see Coderush (disambiguation). CodeRush Developer(s) DevExpress Stable release 2010.2 (for Visual Studio 2010/2008/2005), 2.5 (for VS.NET 2003) / December 1, 2010; 10 months ago (2010 12 01) Pr …   Wikipedia

  • CodeRush (программа) — У этого термина существуют и другие значения, см. Coderush. CodeRush Тип Дополнение для Microsoft Visual Studio версий .NET 2003, 2005, 2008, 2010 и 2012 Разработчик DevExpress Операционная система Microsoft Windows Последняя версия 2012.2.4 (для …   Википедия

  • Automated Build Studio — Infobox Software name = Automated Build Studio developer = AutomatedQA website = [http://www.automatedqa.com/products/abs Automated Build Studio page] latest release version = 5 latest release date = September 8, 2008Automated Build Studio… …   Wikipedia

  • Liste von Modultest-Software — Inhaltsverzeichnis 1 ABAP 2 C 3 C++ 4 Cobol 5 Delphi …   Deutsch Wikipedia

  • NUnit — Aktuelle Version 2.5.10.11092 (2. April 2011) Programmier­sprache .NET Lizenz zlib Lizenz …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”