How to create an ordered test programmatically?

Yesterday an internal customer asked me on how he can create an ordered test programmatically. This was the first time someone had asked me this but I could imagine that it is useful if you have a fixed logic to define the order and have reasonable # of ordered tests to create/maintain. Since ordered tests…


How does testsettings file get used in vstest.console?

In this post, I want to talk about the settings switch and what do we do when a user has passed testsettings file in vstest.console command-line. Vstest.console runner exposes a command-line switch called /settings in which it accepts both runsettings file as well as test settings file. But the test platform APIs (ITestPlatform, ITestRunRequest, TestRunCriteria…


How to specify results directory with vstest.console

VSTest.console command line runner creates the results in the current directory of the command prompt by default but you can change and this post talks about how you can do that. 1. Create a run settings file specifying the results directory. For example the following content in runsettings file will create results in directory c:\temp….


How to run tests on a machine without Visual Studio/Team Build/Test agent etc?

I have heard a lot of customers ask about how to make the tests run on a machine without visual studio components or whether you have xcopy-able install etc. The official answer to all these questions is that you should have a visual studio or team build or test agent installed on the box, but…


How to run test explorer based tests from a stand-alone executable?

To run test explorer based tests from your own custom exectuable (32 bit/64 bit does not matter), you should do the following steps: –   Ensure that you have visual studio 2012 or above installed on your machine. Download this sample (RunTests.exe) and extract it on your machine. You can use this as a starting…


Change ClassCleanup timeout

I have seen few people writing a lot of code in their class cleanup and then complaining that the clean-up is timing out and how they can increase this timeout. To do this, I suggest them the following steps: – Ensure that your class cleanup is indeed timing out. To do this, please check whether…


How to preserve the test results directory?

In VS 2012, when you are running mstest based tests, then the framework deletes the test results directory when the following condition is met. All the test case passes. There is no attachment which got produced in the test run. The option to preserve the test results directory is turned off (default is off). This…


How to enable MSTest logs

Here are the steps which you should perform to enable mstest logs. 1. Go to your mstest installation directory via an administrator command prompt. (typically the installation directory is something like C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\). 2. Open the mstest configuration file (mstest.exe.config) and add a snippet similar to the one shown below under the…


A test run must be created with at-least one test case

I was trying to run an automated test using TCM.exe and the executable was failing with a message saying “A test run must be created with at-least one test case.” On looking at the code, I found why it is failing and what should I do to come out of this error. Later on I…