mstest

In Visual Studio Test, how to make a playlist which automatically excludes certain tests?

倖福魔咒の 提交于 2019-12-03 05:21:01
Our team has Visual Studio 2012 Professional licenses (not Test Professional). We are developing a smallish web application, and we have both true unit tests which mock everything needed, and tests for the data layer. Each class of data layer tests creates the whole database from scratch and fills it with a prepared set of test data, so running them takes a long time. As a result, we are reluctant to do a "run all", and our unit tests (which are quick) are only used rarely. We are looking for a low-friction solution which will allow us to run all quick tests with 2-3 clicks (similar to the

MsTest - executing method before each test in an assembly

泄露秘密 提交于 2019-12-03 05:19:25
Is it possible to run specific method before each test in an assembly? I know about TestInitialize attribute but this attribute has "class scope". If it's defined in a Test class it will be executed before each test from this class. I want to define a method that will be executed before each test defined in a whole assembly. I am not sure that this feature is possible in MsTest out of box like in other test frameworks (e.g. MbUnit). If I have to use MsTest, then I am solving this by defining abstract class TestBase with [TestInitialize] attribute and every test which needs this behaviour

Visual Studio 15.8.1 not running MS unit tests

烂漫一生 提交于 2019-12-03 04:43:22
问题 When I updated Visual Studio to the latest version, 1 of my test projects stopped running tests and outputted this message: Test project {} does not reference any .NET NuGet adapter. Test discovery or execution might not work for this project. It is recommended to reference NuGet test adapters in each test project in the solution. UPDATED: I was using MS Test as opposed to any other test frameworks like Nunit or Xunit. 回答1: Ok, you can add Nuget packages as asked. But you can also try to

Visual Studio 2010 does not discover new unit tests

别来无恙 提交于 2019-12-03 04:43:12
问题 I am writing some unit tests in Visual Studio 2010. I can run all tests by using "Run all Tests in Current Context". However, if I write a new unit test, it does not get picked up by the environment - in other words, I am not able to find it in Test List Editor, by running all tests, or anywhere else. If I unload the project and then reload it; the new test is available to run. When I am adding a unit test, I simply add a new method to an already existing TestClass and decorating it with

C#: How do I check “no exception occurred” in my MSTest unit test?

a 夏天 提交于 2019-12-03 04:08:17
I'm writing a unit test for this one method which returns "void". I would like to have one case that the test passes when there is no exception thrown. How do I write that in C#? Assert.IsTrue(????) (My guess is this is how I should check, but what goes into "???") I hope my question is clear enough. Your unit test will fail anyway if an exception is thrown - you don't need to put in a special assert. This is one of the few scenarios where you will see unit tests with no assertions at all - the test will implicitly fail if an exception is raised. However, if you really did want to write an

MSTest.exe (VS2012) crashes QTAgent32.exe

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 03:23:46
i am trying to execute our tests via cmdline. I use VS2012, but i always get this error: When i run the tests directly in VS2010 on the same machine they run fine. I can't use VS2010 for cmdline because we have the wrong license ( assembly finding doesn't work ) so i have to use 2012. All Windows updates are present. Has somebody had similar issues with MSTest/VS2012 ? Yanhua If you want to keep VS 2012 update 2, 3, or 4 installed, you can try the below workaround: Run the below commands in the command line: DEL /S %windir%\*Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.ni

How to integrate NUnit tests into a TFS 2010 build

白昼怎懂夜的黑 提交于 2019-12-03 02:30:57
What is the best way to integrate nunit tests into TFS 2010? Is it via generic tests or is there a better approach to running them? Ideally I'd like to have the granularity of one generic test per test assembly and have a way to surface the results in the TFS build report. Rhapsody You can run nunit tests from command line and therefore you can automate these tests via your (Workflow) build template. Since there aren't a lot of custom build activities available for TFS 2010 yet, you could write your own to make sure that it integrates better with the TFS Build Report. Here you can find some

What is the relative path root of DeploymentItemAttribute?

有些话、适合烂在心里 提交于 2019-12-03 02:05:39
Using MSTest , what is the relative path root of the DeploymentItemAttribute . Per the MSDN page... Relative paths are relative to the RelativePathRoot setting found in the .testrunconfig file. That setting is, by default, the Solution directory . So, if you have this project structure SecretProject\ ComponentA\ ComponentA.Test\ Resources\ required.xml ComponentA.Test.csproj Tests.cs SecretProject.sln And you want to deploy required.xml , you're going to create a DeploymentItemAttribute like this [TestClass] public class Tests { [TestMethod] [DeploymentItem("ComponentA.Test\Resources\required

Visual Studio required to run MSTest test on Team City Build Server?

删除回忆录丶 提交于 2019-12-03 01:36:46
We are setting up a Team City build server. On previous VS 2008 projects a full version of Visual Studio has been installed on the build server. We are now starting a VS 2010 project. Is it possible to run MSTest tests on the Team City build server without installing Visual Studio? Download the Visual Studio Agents 2010 ISO: http://www.microsoft.com/en-us/download/details.aspx?id=1334 Mount/Extract the files and copy them to the agent server Run AutoRun and select to install Microsoft Visual Studio Test Agent 2010 Install using the default settings Cancel out of the "configuration" dialog (you

How to get TeamCity to run tests using MSTest?

拜拜、爱过 提交于 2019-12-03 01:26:24
I am trying to figure out how to make TeamCity run my MSTests. I have setup a build step using the following parameters: Path to MSTest.exe: %system.MSTest.10.0% List assembly files: Projects\Metadude. .Tests\bin\Debug\Metadude. .Test.dll MSTest run configuration file: Local.testsettings However when this step runs, it does not execute any tests. This is the output from the log: [02:13:49]: Step 2/2: Run Unit Tests (MSTest) [02:13:49]: [Step 2/2] Starting: "D:\Program Files (x86)\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe" #TeamCityImplicit [02:13:49]: