<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Dominic Hopton's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/dhopton/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/dhopton/feed.xml</link>
    <description>A Compendium of blogsicles</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:50:02 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Running two Microsoft Test Manager’s Side By Side</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/running-two-microsoft-test-managers-side-by-side</link>
      <pubDate>Fri, 26 Feb 2010 16:08:10 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2010/02/26/running-two-microsoft-test-managers-side-by-side/</guid>
      <description><![CDATA[When working with Microsoft Test Manager (MTM), you might want to run two at a time. We often want...]]></description>
      <content:encoded><![CDATA[<p>When working with Microsoft Test Manager (MTM), you might want to run two at a time. We often want this internally so we can test MTM with MTM. However, when we created MTM, we didn’t want people to accidently open up multiple instances just because they lost MTM in the noise of all the windows they have open up on the machine. Additionally, if your opening MTM results from Visual Studio (as a developer), we want to use one instance of MTM. This means one MTM at a time.</p> <p>However, it turns out there is a simple work around for this – run MTM as a different user. All versions of windows support this from Windows XP to Windows 7. Vista makes you work a little harder, pushing you to the command line.</p> <p>Windows XP/2003:</p> <p>a) Find the shortcut for MTM on the start menu<br>b) Right click<br>c) Select ‘run as different user’</p> <p>Windows 7/2008 R2:</p> <p>a) Find the short cut for MTM on the start menu, or the task bar<br>b) shift-right click (e.g. hold down the shift key, and right click), on the shortcut<br>c) Select ‘run as different user’</p> <p>Windows Vista/2008:</p> <p>a) run a command prompt<br>b) type “runas /u:&lt;domain and user&gt; &lt;path to MTM.exe&gt; (e.g. runas /u:woodgrove\otherUser “c:\program files\microsoft visual studio 10.0\common7\ide\mtm.exe), and hit enter<br>c) enter the password, and the application will start</p> <p>You now have two independent versions of MTM, which can connect to different servers.</p> <p>Note, if you try to do data collection, or record actions at the same time in both, you will hit issues such as incorrect data, and potentially crashes. I don’t recommend this.</p> <p><strong>IMPORTANT:</strong> This is <strong>NOT </strong>supported. Your mileage may vary.</p>]]></content:encoded>
    </item>
    <item>
      <title>Republishing Results</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/republishing-results</link>
      <pubDate>Thu, 14 Aug 2008 14:04:29 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2008/08/14/republishing-results/</guid>
      <description><![CDATA[There was a interesting question posted in my comments on the TRX file format, about being able to...]]></description>
      <content:encoded><![CDATA[<p>There was a interesting question posted in my <a href="https://blogs.msdn.com/dhopton/archive/2008/06/12/helpful-internals-of-trx-and-vsmdi-files.aspx#comments">comments</a> on the <a href="https://blogs.msdn.com/dhopton/archive/2008/06/12/helpful-internals-of-trx-and-vsmdi-files.aspx">TRX file format</a>, about being able to republish results to TFS Server. This is an oft requested behavior, and the short answer is "no, you can't". Once you've published it, it's there forever. You can, technically, delete an re-publish, but in the scenario <a href="https://dev.net.ua/blogs/dmytrol">DmytroL</a> was looking at, it ain't gonna help. This is resolved in the next big release, which one can see a preview of this in the <a href="https://blogs.msdn.com/jeffbe/archive/2008/04/11/april-rosario-ctp-now-available.aspx">April Rosario CTP</a>, but in that release, is focused on using the new manual test tool to republish results.</p> <p>However, it is possible to create a solution with some coding to merge the TRX files (something we don't have in the product).</p> <p>Lets work through DmytroL's questions:</p> <p><em>1. Is it possible to publish several TRX files under the same test run (of course provided all the TRX files in question specify the same correct test run GUID in the TestRun tag)?</em>  <p>No. You can't. If you try to publish a run that was already published (irrespective of the actual contents), we will block you from publishing -- you'll receive an error that the run has already been published. <p><em>2. Is it permitted to overwrite the outcome of a certain test within the same test run? </em> <p>No. There needs to be one outcome. While (With some simple testing i just did), it is possible to have the same test in the results file, with different executionId's, this is completely <strong>unsupported</strong>. I would expect things to become pretty sticky on the server if you published a file like this (if you have a test server, you could try... YMMV, everything may break, no I won't help you if it takes down your production server...) <p><em>3. Are there any potential problems if these TRX files are published by different people? </em> <p>See (1) &amp; (2) :) <p><em>The scenario behind all this is: a test run is a collection of manual tests put together to verify certain functionality (I know there's a notion of test list for this, but one can't slice the TFS warehouse cube by test lists). Now, subsets of the test run are assigned to different QA engineers for execution. So, each QA engineer goes through her "share" of tests and publishes the results - but the results from all QA Engineers involved should go under the same test run. </em> <p>Write a tool that loads the results from each run, and then sorts them by time, and pick the post recent result (or whatever criteria you decide on), and output a single TRX, and publish  <p>Also, it's important to note that you can slice the warehouse the way you want to -- when you publish multiple runs against one build (which <strong>is</strong> allowed, supported and expected), the roll up data goes into the warehouse with the <strong>most recent</strong> result being the "roll up" result for that test.</p>]]></content:encoded>
    </item>
    <item>
      <title>This weeks favourite WPF Feature</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/this-weeks-favourite-wpf-feature</link>
      <pubDate>Sat, 05 Jul 2008 21:07:53 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2008/07/05/this-weeks-favourite-wpf-feature/</guid>
      <description><![CDATA[I've recently been trying to resolve some issues related to large fonts / high DPI, and while...]]></description>
      <content:encoded><![CDATA[<p>I've recently been trying to resolve some issues related to large fonts / high DPI, and while they've all been simple, one thing had been bothering me in my "designer hat" mode of thinking. We've got the titles of a number of documents in our shell selectable, and copyable, but not editable. This is to allow users to copy titles from bugs, or work item ID's simply &amp; easily; however because we've done this as a styled, read-only text box, it means that when the area containing the text box is too small, the text is cut off, and we can't set TextTrimming="CharacterEllipses" to get the "..." behaviour. This isn't a huge problem, but since I was dealing with these types of issues anyway, I decided to take a shot at fixing it simply &amp; easily. And i came up with this:</p> <p align="center"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dhopton/WindowsLiveWriter/ThisweeksfavouriteWPFFeature_FEAD/image_2.png" original-url="https://blogs.msdn.com/blogfiles/dhopton/WindowsLiveWriter/ThisweeksfavouriteWPFFeature_FEAD/image_2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="32" alt="Faded out text box text" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dhopton/WindowsLiveWriter/ThisweeksfavouriteWPFFeature_FEAD/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/dhopton/WindowsLiveWriter/ThisweeksfavouriteWPFFeature_FEAD/image_thumb.png" width="240" border="0"></a> </p> <p>Notice how on the item on the right is faded out towards the end of the text box? That was super simple with the following piece of XAML:</p> <p><pre>&lt;TextBox.OpacityMask&gt;<br>&nbsp;&nbsp;&nbsp; &lt;LinearGradientBrush&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;GradientStop Color="Black" Offset="0.8"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;GradientStop Color="Transparent"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Offset="1.0" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/LinearGradientBrush&gt;<br>&lt;/TextBox.OpacityMask&gt;
</pre>
<p></p>
<p>You can apply this to any UIElement derived class, which basically means almost any WPF control. In our application, the text box is styled to be transparent and have no border, so it looks better. But one can see the basic end effect here. On area I'm thinking of applying it to next is items in ScrollViewers -- when the items at the bottom are cut off, it'd be nice to see them with a slight fade rather than just been unceremoniously cut off.</p>]]></content:encoded>
    </item>
    <item>
      <title>Helpful Internals of TRX (and VSMDI files)</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/helpful-internals-of-trx-and-vsmdi-files</link>
      <pubDate>Fri, 13 Jun 2008 02:06:55 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2008/06/13/helpful-internals-of-trx-and-vsmdi-files/</guid>
      <description><![CDATA[One of the questions that comes up internally, and externally is "What are these magic GUID...]]></description>
      <content:encoded><![CDATA[<p>One of the questions that comes up internally, and externally is "What are these magic GUID attributes in the file? How can I generate them?". This is often from people who are creating tools to export TRX files from some sort of private test hardness, or generate VSMDI files in an automated fashion.</p> <p>Note, that the XSD schemas are available with all visual studio installs in the: <pre>%VSINSTALLDIR%\xml\Schemas\vstst.xsd file</pre>
<p></p>
<p>directory, along with many other schemas.</p>
<p><strong>TRX Files</strong></p>
<p>Lets take a look at TRX files first. I'm not going to go through the whole file line by line -- we put a lot of info into the file, and some of it can be easily guessed. Things in the TRX file other than the obvious "results":</p>
<ul>
<li>Runconfig - we just dump in the whole run config that was use as part of that run 
<li>Test List info - The test list info etc that was associated with the tests as they were run. If you just run the test from test view, or use the keyboard shortcuts (Ctrl-R, T), you won't see the test list info.</li></ul>
<p>Neither of these pieces of information are required per-se, we just dump them in there for reference reasons (mostly for re-running without having all the original information).</p>
<p>Interesting lines:</p>
<p>&lt;TestRun id="<b>774eb9dc-b311-4cdd-9987-48dd12f1e5f4</b>" /&gt;</p>
<p>The GUID here is just a randomly generated GUID -- Guid.New().ToString() is good enough here, it's just used to allows us to identify the run compared to any other arbitrary run.</p>
<p>&lt;TestRunConfiguration name="<b>Local Test Run</b>" id="<b>3b7e71cb-2506-4724-9b77-b3f5d5c4dd70</b>"/&gt;</p>
<p>This GUID is ID of the Test Run Config that was copied from the one specified at the time the run was created. This should match, but there's no specific need -- we don't go and look up that GUID later.</p>
<p>&lt;UnitTest id="<b>59863143-3238-122e-4d8a-637b491cc755</b>"/&gt;</p>
<p>This is where it gets interesting. This element, which is found under the TestDefinitions element enumerates/declares all the tests that are part of this run. Tests have a name, which is used to provide a friendly way for users to identify test cases from each other. However, the tests themselves need to be uniquely identified within the test system. Most test types (all but unit, for the ones that are shipped in-box) are identified using a random GUID, which is stored in the file the test is stored in. Example: Open up a word based manual test, and look on the properties of it -- you'll see an item which has a GUID in it, and is called "ID". The ID here on these child elements (children of TestDefinitions) is that same GUID as found the test. However, this is <strong>not</strong> the case for unit tests. Unit tests are generated using a hash fully qualified class name, and the method name [1] (i.e. Company.Product.TestClass.TestMethod).</p>
<p>&lt;Execution id="<b>958d14e2-2f82-4f2c-8e91-84543ca85428</b>" /&gt;</p>
<p>This is another "random" GUID, however it <strong>is</strong> referred to later in the file, specifically as part of the results and tracking which tests were executed, so make sure that if you're generating here, your not just throwing the GUID out of the window after you generate it.</p>
<p>&lt;TestLists&gt;<br>&lt;TestList name="<b>All Loaded Results</b>" id="<b>19431567-8539-422a-85d7-44ee4e166bda</b>" /&gt;<br>&lt;/TestLists&gt; 
<p>This is similar to the test run configuration section, where it's a dupe of the actual test list file. This contains all the test lists that are in this run, with the name (as we can see), and the GUID -- again, this really is just a random GUID. But as per &lt;Execution /&gt;, it's used later in the file. 
<p>&lt;TestEntry testId="<b>59863143-3238-122e-4d8a-637b491cc755</b>" executionId="<b>958d14e2-2f82-4f2c-8e91-84543ca85428</b>" testListId="<b>8c84fa94-04c1-424b-9868-57a2d4851a1d</b>" /&gt; 
<p>Test Entry provides a match between test lists, the test case, and the test result. Note that these GUIDs here refer to the IDs previously seen throughout this post. Make sure these GUIDs match up, and your results will all be peachy. 
<p>&lt;UnitTestResult executionId="<b>958d14e2-2f82-4f2c-8e91-84543ca85428</b>" testId="<b>59863143-3238-122e-4d8a-637b491cc755</b>" /&gt; 
<p>These are the results (whose elements are determined by the test type that was executed, hence the 'UnitTestResult'), and as one can see, there are some guids here, which tally back to elements &amp; ID's that were declared earlier in the file -- specifically the execution ID, and the test ID (since this is a unit test, the computed ID). 
<p><strong>VSMDI Files</strong> 
<p>The VSMDI file format is much simpler, although equally filled with GUIDs :). The basic format here is the runconfig (don't ask why it's in there, it's got long historical reasons, and does allow for an... interesting scenario [2]) attached to the of the test lists (which is the same GUID no matter what), and then all the other test lists in the file, with their own GUID, a guid linking to a <strong>parent</strong> test list, and the contents of that list itself. Lets look at an example. 
<p>&lt;TestList name="<b>Lists of Tests</b>" id="<b>8c43106b-9dc1-4907-a29f-aa66a61bf5b6</b>"&gt; 
<p>This is the "Root" test list, the one you see at the root of test list editor window - an immovable, unchangeable test list. This GUID is <strong>constant</strong> and the same in all VSMDI files, and all machines. It's been the same GUID since we shipped the first beta of VS 2005 (amusing to think that was over 4 years ago). If you don't have this, then things are going to go a bit <a href="https://www.urbandictionary.com/define.php?term=Pete+Tong" target="_blank">pete tong</a>. 
<p>Other test lists take the same form, but with there own GUID, which is merely a randomly generated GUID: 
<p>&lt;TestList name="<b>SampleList</b>" id="<b>e3d327f8-49dd-4ee0-b8c0-57e9b47d6cff</b>" parentListId="<b>8c43106b-9dc1-4907-a29f-aa66a61bf5b6</b>"&gt; 
<p>Here, we can see that this node is a child of the parent node (Lists of Tests) by noting the parentListId GUID is the same as the ID guid of the "Lists of Tests" test list. This allows you to establish many levels of nesting of test lists to create the right grouping and categorization you need. However, for tests to appear in these test lists, you need to add child elements of this TestList element: 
<p>&lt;TestLink id="<b>59863143-3238-122e-4d8a-637b491cc755</b>" /&gt; 
<p>Here, the ID refers to the <strong>test id</strong> of the test being linked in. If you look back through this article you can see the ID of this test showing in the TRX file section -- these IDs really do identify the test across multiple stores (even into the TFS warehouse if you push your results there). 
<p><strong>Conclusion</strong> 
<p>There you have it, a whirl wind tour of the TRX and VSMDI file formats -- which should provide some insight for understanding the rest of our file formats. Note that while some of the information here is still relevant to VS 200<strong>5</strong>, the file format in that version is radically different, and requires some what unnatural acts to be able to generate it from outside of VS -- I would recommend upgrading to 2008 if you wish to do that :) 
<p>[1] We hash the fully qualified test method with code like this:</p>
<p><pre>using System;
using System.Diagnostics;
using System.Security.Cryptography; 

namespace TeamTestSample
{
    internal static class UnitTestIdHash
    {
        private static HashAlgorithm s_provider = new SHA1CryptoServiceProvider(); 

        internal static HashAlgorithm Provider
        {
            get { return s_provider; }
        } 

        /// <summary>
        /// Calculates a hash of the string and copies the first 128 bits of the hash
        /// to a new Guid.
        /// </summary>
        internal static Guid GuidFromString(string data)
        {
            Debug.Assert(!String.IsNullOrEmpty(data);
            byte[] hash = Provider.ComputeHash(System.Text.Encoding.Unicode.GetBytes(data)); 

            // Guid is always 16 bytes
            Debug.Assert(Guid.Empty.ToByteArray().Length == 16, "Expected Guid to be 16 bytes"); 

            byte[] toGuid = new byte[16];
            Array.Copy(hash, toGuid, 16); 

            return new Guid(toGuid);
        }
    }
}
</pre>
<p></p>
<p>[2] One little know feature of the testing tools inside visual studio, is that you can re-run a test run without sources, just by picking up the test results directory, and opening the TRX file, and clicking the run button. What is even less known is that if you have the Test storages (the dlls, webtest, etc), and the VSMDI, you can open the VSMDI directly (no project, or solution), and select the tests to run. The test run configuration that will be applied will the last test run configuration that was active when the vsmdi was last edited.</p>]]></content:encoded>
    </item>
    <item>
      <title>Running Tests as 'MTA'</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/running-tests-as-mta</link>
      <pubDate>Mon, 22 Oct 2007 12:08:52 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2007/10/22/running-tests-as-mta/</guid>
      <description><![CDATA[There was an internal discussion this week about the need to run unit tests under MTA threads,...]]></description>
      <content:encoded><![CDATA[<p>There was an internal discussion this week about the need to run unit tests under MTA threads, rather than the default STA -- either for COM, or in this specific discussion for WaitHandle.WaitAll.</p> <p>Mark Seemann went and posted a <a href="https://blogs.msdn.com/ploeh/archive/2007/10/21/RunningMSTestInAnMTA.aspx">short guide</a> on how to enable this in both Visual Studio 2005 (whidbey) and Visual Studio 2008 (Orcas).</p> <p>Enjoy!</p>]]></content:encoded>
    </item>
    <item>
      <title>Private[Object|Type|Accessors] &amp; Automatic unpacking of ref/out params</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/privateobjecttypeaccessors-automatic-unpacking-of-refout-params</link>
      <pubDate>Thu, 20 Sep 2007 12:22:26 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2007/09/20/privateobjecttypeaccessors-automatic-unpacking-of-refout-params/</guid>
      <description><![CDATA[I was writing some unit tests yesterday, and needed to test a private method. As I was gleely...]]></description>
      <content:encoded><![CDATA[<p>I was writing some unit tests yesterday, and needed to test a private method. As I was gleely tapping in the code to call my static method using PrivateType, I noticed that two of my parameters were "out" parameters. I immediately went 'Hmm, I bet private type doesn't do anything special for those parameters'. I cast my mind back to a bug I fixed with the new Publicize tool in VS2008 where by ref/out parameters that were actually accessor types were not being 'unwrapped' and passed back out to the test code. Turns out we weren't doing the right thing here, but in fact reflection was helping us.</p> <p>Reflection, when you give it the params array to Invoke, it actually automatically unpacks (although, in reality, I don't think there is any unpacking going on) the out/ref's into the same array, so you can get back at them. This means that since Private[Type|Object] are just simple wrappers around reflection, their Invoke methods do the work for you, and in fact everything works for free.</p> <p>In the case of accessors, the experience is (now) the same. But it wasn't a complete no-brainer to get it to work. See, when we call the private method from the accessor, we have to unpack all the accessor types into their raw type, to pass to the actual method. This means that when the invoke returns, the 'raw' array has those ref/out values. But before we can return to the test code (the real caller), we have to 'repack' the instances into accessor types using the attach functionality of PrivateObject. It's a bit hairy when it comes to value types rather than ref types, but ultimately it's all good.</p>]]></content:encoded>
    </item>
    <item>
      <title>Unit Testing Dependency Properties with VSTT, a first stab</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/unit-testing-dependency-properties-with-vstt-a-first-stab</link>
      <pubDate>Mon, 17 Sep 2007 19:28:18 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2007/09/17/unit-testing-dependency-properties-with-vstt-a-first-stab/</guid>
      <description><![CDATA[I've been playing around with WPF recently, and one of the things I've ended up doing is creating a...]]></description>
      <content:encoded><![CDATA[<p>I've been playing around with <a href="https://wpf.netfx3.com/">WPF</a> recently, and one of the things I've ended up doing is creating a set of custom controls (rather than User controls), as well as what I will call 'aggregation' classes[1]. Some of these have had a fair chunk of code that has been in need of unit testing. We don't want to end up down the path of testing everything through the UI, which has notoriously difficult with UI code in the past. With WPF it's a lot easier due to the wonderful separation of church and state (Look n feel vs logic).</p> <p>When I started down this path, I went along my merry way creating <font face="Courier New" size="2">[TestMethod]</font>'s, and running them one-at a time. In conjunction with <font face="Courier New" size="2">[TestInitialize],</font> they were all passing wonderfully. "Great!" I thought, "lets run them all together and see lots of green....". Uh oh. All but the first failed. Had I really written that bad a custom control? (Being me, that's perfectly possible).</p> <p>When I saw the error message, I knew what exactly what was going on:<br><font face="Courier New">Test method Foo.RendererIsCleared threw exception:&nbsp; System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it..</font></p> <p>With a call stack that looks like:<br>System.Windows.Threading.Dispatcher.VerifyAccess()<br>System.Windows.DependencyObject.GetValue(DependencyProperty dp)<br>FooBar.get_Thingy()<br>FooBar.ThingyChanged()<br>FooBar.Doohick_PropertyChanged(Object sender, PropertyChangedEventArgs e)<br>System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)</p> <p>This is clear -- dependency properties don't support MTA scenarios (duh), which is a bit of a problem when each and every <font face="Courier New">[TestMethod]</font> is executed on a <strong>different</strong> thread. TestInitialize &amp; first test executed are run on the same thread, and the last thread, and <font face="Courier New">[ClassCleanup]</font> are run on the last thread. This, you can see causes somewhat of a problem. How can we work around this?</p> <p>My first attempt was 'ah-ha. Dispatcher allows you to invoke methods on the dispatcher thread, and thus I can get them to execute on the same thread they were created on'. Sadly this doesn't work. The thread that the DP's are created on (on the <font face="Courier New">[TestInitialize]</font>'s thread), has actually <strong>gone away</strong>. So, since you need to invoke on the thread the DP was created on... oops. It's gone away. This is a bit of a problem.</p> <p>My 'quick fix' solution is to code up all the <font face="Courier New">[TestMethod]</font>s in the test class as normal, but mark them with <font face="Courier New">[Ignore]</font>, so they can't be run. Then, create one <font face="Courier New">[TestMethod]</font> that is Called 'AllTests'. This method will then call all the other <font face="Courier New">[TestMethod]</font>s, and ensure they are all called on the same thread. To make this really work you should call initialize &amp; cleanup before and after. I did the following pattern:</p> <p><font face="Courier New">public delegate void TestDelegate(); </font> <p><font face="Courier New">public void DoTest(TestDelegate test)<br>{<br>&nbsp;&nbsp;&nbsp; TestInitialize();<br>&nbsp;&nbsp;&nbsp; test();<br>&nbsp;&nbsp;&nbsp; TestCleanup();<br>}</font></p> <p>With my AllTests method looking like:<br><br><font face="Courier New">[TestMethod]<br>public void RunAllWatermarkingTextboxTests()<br>{<br>&nbsp;&nbsp;&nbsp; DoTest(WatermarkProperty);<br>&nbsp;&nbsp;&nbsp; DoTest(ResetOnFocusLossPropertySettingGetting);<br>&nbsp;&nbsp;&nbsp; DoTest(HasInputtedTextProperty);<br>&nbsp;&nbsp;&nbsp; DoTest(PreviousTextPropertyDefaultValue);<br>&nbsp;&nbsp;&nbsp; DoTest(LostFocusEventing);<br>&nbsp;&nbsp;&nbsp; DoTest(ResetOnFocusLossBehaviour);<br>}</font></p> <p><strong>But this doesn't completely solve it...<br></strong>You loose out on <font face="Courier New">[ExpectedException]</font>, data driven, etc. This is not particularly good, but this is a good start. Additionally, the 'investigation' can be tiresome since you no-longer get the actual test that failed, just the call stack, so you have to do the leg work (Made a little bit easier thanks to the clickable call stack in Orcas).</p> <p>The solution here is to build a more complex base class to do all the init on a thread that isn't going to die. When I get some time to do that, I'll make sure I post it here. :)</p> <p>[1] We have a chunk of code that is 'old school' and while we've brought it forward with INotifyPropertyChanged/INotifyCollectionChanged, it's not quite there yet, and we really want to do some rich binding with dependency objects, so I ended up creating a class which aggregates some events into some house keeping code &amp; dependency properties. It's been very powerful so far.</p>]]></content:encoded>
    </item>
    <item>
      <title>STARWest meetup?</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/starwest-meetup</link>
      <pubDate>Mon, 14 Nov 2005 17:53:00 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2005/11/14/starwest-meetup/</guid>
      <description><![CDATA[Some of the team are at the STARWest conferance in Anaheim this week. We're here for the two...]]></description>
      <content:encoded><![CDATA[<P>Some of the team are at the STARWest conferance in Anaheim this week. We're here for the two "Tutorial" days, and the full conference itself. While we're not here to demo, or hang out in the expo hall (We're just regular attendies), we'd love to meet up with any customers and users out there to talk about Team Test and Team foundation.</P>
<P>Is there any interest in this? If there is leave a comment on the blog, and if theres enough response we'll sort a time and place to meet up.</P>
<P>We can talk about the product, any problems you might have had, and if we're lucky even demo some of the team foundation features.</P>
<P>Let us know!</P>
<P>Dominic</P>
<P>[X-Posted from the <a href="https://blogs.msdn.com/dhopton">VSTS Quality Tools Blog</A>]</P>]]></content:encoded>
    </item>
    <item>
      <title>Where Have I been? Helping make Team System Rock!</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/where-have-i-been-helping-make-team-system-rock</link>
      <pubDate>Fri, 14 Jan 2005 21:53:00 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2005/01/14/where-have-i-been-helping-make-team-system-rock/</guid>
      <description><![CDATA[Well, It's been a long time since I blogged - actually, I've not blogged since we shipped our very...]]></description>
      <content:encoded><![CDATA[<p>Well, It's been a long time since I blogged - actually, I've not blogged since we shipped our very first release just after Beta 1.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></p> <p>So, what’s been happening with the Testing tools in Team System? Well, I've still got Test View, Manual Testing and Test Project but I now also own Unit Test Debugging, Generic Testing (very useful) and Check-in policy support for Hatteras Source Code Control. But, I've lost Solution Integration -&nbsp;Michael (who owns Code Gen testing) now owns that.<o:p></o:p></p> <p>In that time we've released a couple of CTPs that have included our bits - the most recent being The December CTP.<o:p></o:p></p> <p>As you'd expect, all of the issues that I talked about in previous blogsicles have been fixed - we're looking in great shape right now. Some of the new functionality we have now in my feature areas are really compelling. Taking debugging as an example - enabling this has made my job of writing tests&nbsp;a lot easier. Just being able to set a break point in the test code and its hit - It's fantastic.<o:p></o:p></p> <p>Generic testing enables you to integrate pre-existing test harness &amp; result reporting into our infrastructure. For the full effect, you need to add some code to your test result reporting to output xml (we supply an XSD) with greater detail. Very powerful if you want to take advantage out our integrated solution but don’t want to port all your tests.<o:p></o:p></p> <p>Check-in policy is quite possibly my favourite from a what-it-enables aspect - the ability to have a set of tests that <strong>must</strong> pass before a developer can check-in his code is fantastic. It's such a great way to help ensure that quality of code in the source repository is of a high standard.</p> <p>I hope to blog more - it's one of my new years resolutions! I look forward to hearing comments from you, and also make sure you check on <a href="https://msdn.microsoft.com/chats">MSDN Chats</a>&nbsp;for EDT chats.</p>]]></content:encoded>
    </item>
    <item>
      <title>Custom Test Properties &amp; Test View - What is &amp; What will be...</title>
      <link>https://docs.microsoft.com/archive/blogs/dhopton/custom-test-properties-test-view-what-is-what-will-be</link>
      <pubDate>Tue, 25 May 2004 18:09:00 GMT</pubDate>
      <dc:creator><![CDATA[dhopton]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dhopton/2004/05/25/custom-test-properties-test-view-what-is-what-will-be/</guid>
      <description><![CDATA[Ok, So I&#8217;d thought about this blog yesterday but discounted it &#8216;cause its not really my...]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Ok, So I&#8217;d thought about this blog yesterday but discounted it &#8216;cause its not really my area. But what the heck :)</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">There is a very cool feature, which isn&#8217;t fully surfaced yet in the UI. This allows you to define new properties for your tests, which can be shown in the property window. Under test properties you&#8217;ll see &#8220;Test Specific&#8221; group, which shows your new property.</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Right now, the bit that is missing is the ability to group-by &amp; filter on these properties rather than just the core set. I just talked to the Dev who owns Test View (since our PM is at TechEd), and I was remembering right &#8211; our current plan is to allow you to filter, group by and add columns for those properties to the test view. Also, the property window is going to allow you to edit these properties and round trip them to code &#8211; so even if you don&#8217;t know the language your tests are in you can manipulate the custom properties.</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Cool, isn&#8217;t it? :)</P>]]></content:encoded>
    </item>
  </channel>
</rss>