How to data bind a Visual Studio 2013 Coded UI Test

Problem I need to run the same Coded UI Test with different data. Solution Data bind your Coded UI Test.  To data bind a test in Visual Studio you just need access to the data source and add attributes to the test. For this example we are going to use a simply CSV file.  So add a new text file to your project with a CSV extension. Create a comma delimited file of the desired data.  Make sure when you save it you first select “Advanced Save Options” from the File menu and select “Unicode (UTF-8 without signature) – Codepage 65001” before you save the file. Now right click on the item in Solution Explorer and select Properties. From the Properties window change the “Copy to Output Directory” to “Copy always”.   To your test you will need to add two attributes.  The first is the DeploymentItem attribute. This attribute takes a single string argument of the name of the CSV file. The second attribute is the DataSource attribute.  This attribute is where you define the class used to read the data, what table to read from and how the data should be accessed.  For a CSV file the first argument will be “Microsoft.VisualStudio.TestTools.DataSource.CSV” which identifies the correct class to use to load the CSV file.  Next we need to let the test know where to find the data with “|DataDirectory|\\data.csv”.  Then we have to identify the table to read the data from with “data#csv”. Finally we have to give it an access method “DataAccessMethod.Sequential”.  The final attribute will look like this: [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\data.csv", "data#csv", DataAccessMethod.Sequential)] With the attributes in place you can now use the DataRow property of the TestContext to access the columns in your CSV for example: TestContext.DataRow["FirstName"].ToString(); Good luck.

How to change your default language in Visual Studio

Problem: I want to change my default languge in Visual Studio. Solution: Select Tools / Import and Export Settings... Select Reset all settings Click Next > I suggest backing up your current settings just in case you want them back. Select the default Language setup you want to use Click Finish To verify click File/New Project.  Your desired language is selected by default.

Why is my Visual Studio 2013 Command Prompt impossible to find on Windows 8

Problem: I can’t find the Visual Studio 2013 Developer Command Prompt! Solution: Press the Windows key and type "Visual Studio" on the Start screen, and then select "Visual Studio Tools". This will open a File Explorer that contains the command prompt.  Do yourself a favor and right click the item and select "Pin to Start" so you never have to search for it again!

Where are my diagnostic build logs?

Problem: I am trying to customize TfvcTemplate.12.xaml and can’t increase the verbosity level any longer. Solution: Open the desired build and click the Diagnostics menu and select View Logs. Explanation: In the past there was an argument on the build template that allowed you to control the output verbosity.  However, in the new template that argument has been removed and is hardcoded to “Normal” on the call the msbuild.  Nevertheless, the data is being captured in the logs placed in the drop location. Simply double click on the xml files.  If you are prompted for how to open the file select Internet Explorer.  There is an xsl file that will format the data making it easy to read in Internet Explorer. You can read more here.

Tokenization for DSC

Update!  This resources has been officially release by Microsoft here http://tinyurl.com/xReleaseManagement Update 3 of Release Management introduced Desired State Configuration (DSC) as a deployment option in addition to the deployer based solution.  With DSC we can utilized the Local Configuration Manager (LCM) already installed on many Microsoft operating systems to deploy our applications without the need to install prerequisites.  However, I noticed after playing with it for a while that there was no mechanism to tokenize files for transformation. This is a requirement for applications that store configuration information in web.config or app.config files.  This data needs to be updated as the code is promoted from one environment to the next. I set out to fill this gap by writing a custom resource to transform the files as we can with the deployer based option of Release Management.  Attached to this post is a zip file that contains custom Windows PowerShell Cmdlets, custom DSC Resource and a sample configuration that shows how to use them. The xReleaseManagement folder contains the implementation of the Trackyon_xTokenize resource to be used in your configurations. This resource requires the Write-Token and Test-Token Cmdlets provided in the Trackyon.PowerShell.ReleaseManagement.Module module also in the attached zip. Finally in the zip file are to ps1 files with a sample configuration and start-dscconfiguration calls. All of the Cmdlets, resources and tools are provided AS IS, and are not supported through any support program or service. xReleaseManagement.zip (15.90 kb)

Increase the reach of Code Lens and Code Map

Problem: My code lens does not see references to properties in my MVC views .cshtml files. Solution: Install the Razor Generator extension. Explanation: While watching a great deep dive of Code Map by Jean-Marc Prieur he mentioned the Razor Generator as a way to enable features in Code Map and Code Lens. Install both the Razor Generator Extension and the Razor Generator MVC nuget package.  Once the nuget package is installed you can run the Enable-RazorGenerator command from the Package Manager Console. This will cause the Razor Generator to update all your cshtml files so they use a custom tool installed by the Razor Generator extension.   This extension allows processing Razor files at design time instead of runtime, allowing tools like Code Map and Code Lens to walk the code and find the references. Before: Code Lens showing only 2 references After:   Code Lens showing 3 references   Code Map showing the view

Find by Status is not working

Problem: "Find by Status" of the TFS Power Tools always returns zero results even though people have files checked out.    Solution: Make sure the developers workspaces are Server and not Local. Explanation: Only Server workspace communicate the status of check outs back to the Server local workspaces do not.  

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.