<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Michael Koltachev's blog</title><subtitle type="html" /><id>http://blogs.msdn.com/mkolt/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/mkolt/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/mkolt/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2005-07-16T01:34:00Z</updated><entry><title>Using VSTS to do Test Driven Development</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/mkolt/archive/2005/07/29/445039.aspx" /><id>http://blogs.msdn.com/mkolt/archive/2005/07/29/445039.aspx</id><published>2005-07-29T20:19:00Z</published><updated>2005-07-29T20:19:00Z</updated><content type="html">&lt;FONT face=Tahoma size=2&gt;
&lt;P&gt;VSTS doesn't have a pure set of Test Driven Development features, but using the built-in refactoring support for C# you are able to get a good Test Driven Development experience in VSTS 2005. Test Driven Development is a methodology we greatly believe in at Microsoft, new Test Driven Development specific features might show up in future releases.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT face=Tahoma size=2&gt;
&lt;P&gt;Here’s how you can use refactoring to generate shipping code from a Unit Test in VSTS. Let’s say, I need to test class A that has method “string GetData()”. I start from writing the test for it:&lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman CYR" size=2&gt;&lt;/FONT&gt;&lt;FONT face="Courier New CYR" size=1&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;[&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;TestClass&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ATest&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;[&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080&gt;TestMethod&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt; GetDataTest()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080&gt;A&lt;/FONT&gt; a = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;A&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; s = a.GetData();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008080&gt;Assert&lt;/FONT&gt;.AreEqual(&lt;FONT color=#800000&gt;"my data"&lt;/FONT&gt;, s, &lt;FONT color=#800000&gt;"Wrong data returned!"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New CYR"&gt;&lt;FONT face="Courier New" size=2&gt;);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New CYR" size=1&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman CYR" size=2&gt;&lt;/FONT&gt;&lt;FONT face=Tahoma size=2&gt;
&lt;P&gt;I want to generate the A.GetData from this test. Well, since class A does not exist yet, I create it manually as:&lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New CYR" size=2&gt;&lt;/FONT&gt;&lt;FONT face="Courier New CYR" size=1&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;A&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;{&lt;BR&gt;}&lt;/FONT&gt;&lt;FONT face="Courier New CYR"&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman CYR"&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;All I have to do now is right-click a.GetData() in my test and select “Generate Method Stub” from context menu:&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="http://koltachev.members.winisp.net/community/50729_GenerateMethodStub.gif"&gt; 
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;It generates the following code:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Courier New CYR" size=1&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008080 size=2&gt;A&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;internal&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; GetData()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;throw&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;Exception&lt;/FONT&gt;(&lt;FONT color=#800000&gt;"The method or operation is not implemented."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New CYR" size=1&gt;&lt;FONT face="Courier New" size=2&gt;);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman CYR" size=2&gt;&lt;/FONT&gt;&lt;FONT face=Tahoma size=2&gt;
&lt;P&gt;Now I can run the test and make sure it fails. Then I will implement GetData, run my test and fix the code, until the test passes.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=445039" width="1" height="1"&gt;</content><author><name>mkolt</name><uri>http://blogs.msdn.com/members/mkolt.aspx</uri></author></entry><entry><title>Hello!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/mkolt/archive/2005/07/16/439480.aspx" /><id>http://blogs.msdn.com/mkolt/archive/2005/07/16/439480.aspx</id><published>2005-07-16T03:34:00Z</published><updated>2005-07-16T03:34:00Z</updated><content type="html">&lt;FONT face=Tahoma&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=EN-US&gt;&lt;FONT size=2&gt;My name is Michael Koltachev, I’m a developer in Visual Studio Team System at Microsoft. Inside VSTS my team (here’s &lt;/FONT&gt;&lt;a href="http://blogs.msdn.com/VSTSQualityTools/"&gt;&lt;FONT size=2&gt;our team’s blog&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt;) works on Testing Tools and I own the internals of test execution. I could tell you a lot about VSTS and but I’d just say it’s very cool, really, we should have shipped a product with such functionality long time ago, well, it’s soon now and we have Beta 2 available. Here’s a link to &lt;/FONT&gt;&lt;A href="http://lab.msdn.microsoft.com/teamsystem/community/"&gt;&lt;FONT size=2&gt;blogs and forums&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt; on VSTS.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=EN-US&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=EN-US&gt;&lt;FONT size=2&gt;I am going to use this blog to post interesting information about our tools and some tips and tricks. Please share your concerns, ask questions and give feedback about our testing tools. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=439480" width="1" height="1"&gt;</content><author><name>mkolt</name><uri>http://blogs.msdn.com/members/mkolt.aspx</uri></author></entry></feed>