<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Michael Koltachev's blog</title><link>http://blogs.msdn.com/mkolt/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Using VSTS to do Test Driven Development</title><link>http://blogs.msdn.com/mkolt/archive/2005/07/29/445039.aspx</link><pubDate>Fri, 29 Jul 2005 20:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:445039</guid><dc:creator>mkolt</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/mkolt/comments/445039.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mkolt/commentrss.aspx?PostID=445039</wfw:commentRss><description>&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;</description></item><item><title>Hello!</title><link>http://blogs.msdn.com/mkolt/archive/2005/07/16/439480.aspx</link><pubDate>Sat, 16 Jul 2005 03:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:439480</guid><dc:creator>mkolt</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/mkolt/comments/439480.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mkolt/commentrss.aspx?PostID=439480</wfw:commentRss><description>&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;</description></item></channel></rss>