Running Microsoft Test Manager Suite with Release Management

Goal I want to run a Microsoft Test Manager Suite after my bits are deployed by Microsoft Release Management (InRelease). Solution: There appears to be a bug in the current "MTM Automated Tests Manager" tool that will fail if your build definition name contains spaces. So I took this opportunity to write my own PowerShell script to run as part of my deployment within Release Management.  Attached to this post is a PowerShell script that corrects the space issue. The remainder of this post will explain how to add a new tool to Release Management and add a testing component to your release template. Begin by starting Release Management and clicking the Inventory tab then Tools.  Once on the Tools tab under Inventory click the New button.  Feel free to enter any Name and Description you like.  For the command simply type “powershell”. For the Arguments value enter: -command ./MyTcmExec.ps1 -Collection __Collection__ -TeamProject __TeamProject__ -PlanId __PlanID__ -SuiteId __SuiteID__ -ConfigId __ConfigID__ -BuildDirectory __BuildDirectory__ -Title __Title__ If you took the time to read the MyTcmExec.ps1 file you may have noticed not all the parameters are listed in the arguments above.  That is because not all of the arguments are required to have a successful test run. However, if you need to pass in the additional parameters for your situation simply add them to the Arguments.  Each value that begins and ends with double underscore “__” will be assignable on each stage. Now that we have our tool in Release Management lets create a component that uses our tool.  Click the Configure Apps tab then Components. Once on the Components tab under Configure Apps click the New button.  Feel free to enter any Name and Description you like.  On the Source tab simply enter a \ for the Path to package value.  On the Deployment tab is where we select our tool from the Tool dropdown.  Unless you would like to adjust the arguments for this component simply click Save & Close.  Note that any changes to the arguments will only affect this component and not the tool definition. The final step is to add the component to our release template. Click the Release Template tab under Configure Apps.  Right click on Components in the Toolbox and select Add from the context menu.  Select the desired component and click the Link button or simply just double click the component to add it to the toolbox.  Now simply drag and drop the new component to the desired location in your stage’s workflow. Although Release Management has helper variables for example $(PackageLocation), $(TfsUrlWithCollection) and $(TeamProject). I discovered the $(TfsUrlWithCollection) and $(TeamProject) variables do not expand to the expected values.  $(TfsUrlWithCollection) includes the team project and $(TeamProject) expands to an empty string. Therefore, I suggest you simply hardcode those values with the exception of $(PackageLocation) which appears to work as expected. You will have to harvest the PlanID, ConfigID and SuiteID from Microsoft Test manager.  Use the images below to locate those values.  You will also need the URL to the Team Project Collection and the name of the Team Project. Using the values from Microsoft Test Manager and TFS you can now fill in the values of your component.  You can enter any value you like for the Title.  For the BuildDirectory enter $(PackageLocation). The final step is to make sure you have associated automation to test case in your selected suite and the assembly that contains that automation is being built with the solution being released.  Good luck. MyTcmExec.ps1 (6.17 kb)

I keep getting error when I run tcm.exe

Problem: I keep getting the following error when I attempt to run tcm.exe from the command line: “A test run must be created with at least one test case.” Solution: Open MTM and check the status of the test case from the Test tab.  Make sure the test case state is not Error.  If it is reset it to active and try your command again.

I only see the last 10 steps of my Exploratory Testing in MTM when I create a test case.

Problem: I used the "Do Exploratory Testing" freature of Microsoft Test Manager (MTM) but only the last 10 steps show up when I create a test case. Solution: In the new test case window press the "Change steps" button above the test steps.  This will bring up a dialog box allowing you to select additional steps.   Explanation: The default number of steps to include in a test case is 10. That value is in the mtm.exe.config file: <!-- The number of actions selected by default when a bug or test case is created         while exploring the app or providing feedback. The number of actions displayed by default are         four times this number -->    <add key="DefaultNumberOfActions" value="10"/>  

Registering Workgroup Test Agent with Test Controller in Domain

Problem: I have a test controller in a domain and a test agent in a workgroup and I can’t register the agent with the controller. Solution: Create shadow accounts on the agent machine and on the controller machine that are in the Administrators Group.  Shadow accounts are accounts with the exact same name and password. You can test your shadow account by trying to map to a share on the controller machine from the agent machine.  Try to access \\controlerMachine\c$  when you are challenged for credentials use the shadow account.  Note you may have to disable your firewall to perform this test. Install and configure the controller on the controller machine.  In the Configure Controller dialog use your TFS account and select the project collection. Using Microsoft Test Manager (MTM) under the Lab Center tab verify that your controller is registered on the controller tab. Second log in to the test agent machine as the shadow account and install and configure the test agent with the test controller.  When asked for a user name use the shadow account again. Using MTM refresh the contoller and you should see the Test Agent listed.  This machine is now ready to be used in Lab to create a physical environment.

Where do I place pre-conditions for test cases in MTM

Problem: I have preconditions for a test case in Microsoft Test Manager (MTM) but I don’t know where to store or how to notify the tester before executing the test. Solution: Attach a preconditions document to the first step of your test case or create the preconditions as a shared step. Explanation: When creating a Test Case in MTM you can have attachments on each test step in a test case.  One solution to the problem of preconditions is to attach a document that contains the preconditions to the first step of your test case.  Now when the tester begins the test case the first step will be presented with a link to the preconditions document.  From there the tester can simply click the link to open the document and perform the necessary preconditions for the test case. This same method can be used for any post conditions as well be attaching a document to the final step of the test case. Another option is to create the preconditions as shared steps and include them as the first step in the test case.