mstest

TeamCity Setting up MSTest 2012

不羁岁月 提交于 2019-11-29 09:20:37
On the TeamCity server we have installed VS 2012. I have created a build configuration in TeamCity that builds and deploys the solution. I have added a MSTest 2012 Configuration as well, but don't know how to tell it what project is the VS 2012 test project so that it can run those tests. Thanks Dejan Dakić You need to specify assembly file (dll) of your tests, not the project file (csproj). Here's an example: http://shrani.si/f/p/PH/2tO4Zo5s/tmpa4cc.jpg So let's say your Testing assembly is called Company.Tests.dll and it is located in Company.Tests/bin/Debug/Company.Tests.dll Basically, in

How to make unit test run in bin folder

ぐ巨炮叔叔 提交于 2019-11-29 09:16:33
I'm trying to access a file in my solution structure during the unit test. My unit test project has the bin\Debug\ as the output directory. So I have written the code assuming that Path.GetFullPath(".") in my unit test will give me this bin folder. But what it does is it gives me a temporary location as the path. C:\Users\[username]\AppData\Local\Temp\TestResults\[username]_[machine_name] 2013-05-16 08_31_07\Out So obviously my unit test couldn't access the files in my solution. If anyone knows how to make unit test run in the bin folder of the unit test project please help. You can do this by

Is it possible to use the logical call context within a unit test in VS 2010?

佐手、 提交于 2019-11-29 06:20:50
问题 Is it possible to make this test not throw an exception? It appears that adding any non-GACed class into the logical call context causes an exception to be thrown in line 2 of the test. Test 'TestProject1.UnitTest1.TestMethod1' failed: Test method TestProject1.UnitTest1.TestMethod1 threw exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Type is not resolved for member 'TestProject1.Bar,TestProject1, Version=1.0.0.0, Culture=neutral,

MSTest Not Finding New Tests

风格不统一 提交于 2019-11-29 05:59:09
Using VS2010, I can't seem to add additional test methods. If I set up my project like this [TestMethod] public void Test1() { Assert.AreNotEqual(0,1); } [TestMethod] public void Test2() { Assert.AreNotEqual(0,1); } The only test that shows up in my Test View is Test1. How do I make sure Test2 gets in to that list? EDIT: Additional tests that weren't initially created are not added to the list of tests. So if I was to add Test3 after running tests, then Test3 would not get added. Simplest way: Reopen the solution. You can also open your test list file (the "vsmdi" file in your Solution Items

Running VS2010 UnitTests project from TFS2008 Team Build

十年热恋 提交于 2019-11-29 05:17:43
I have a Visual Studio 2010 MVC 3 application with unit tests projects in it. I have a TFS 2008 build definition to build the solution. On the build agent i have got following installed VS2008 team system developer edition VS2010 Professional installed I have updated the msbuildpath in the tfsservice.exe.config to .NET 4 farmework Deleted all the workspaces Have followed all the steps at http://blog.aggregatedintelligence.com/2011/03/vs2010-tfs-2008-and-unit-tests.html But when i run the build I get the following error:- Using "TestToolsTask" task from assembly "c:\Program Files\Microsoft

DataTestMethod and DataRow attributes in MSTEST

ぐ巨炮叔叔 提交于 2019-11-29 04:38:19
问题 I have seen in a Microsoft video about Visual Studio update 2 regarding these attributes. However, I can't find any other information about them and can't get a project to build with them. Does anyone know anything about these attributes or how to get them working? [DataTestMethod] [DataRow("a", "b")] [DataRow(" ", "a")] public void TestMethod1(string value1, string value2) { Assert.AreEqual(value1 + value2, string.Concat(value1, value2)); } 回答1: I know this is an old question, but there is

Is there an API for running Visual Studio Unit Tests programmatically?

家住魔仙堡 提交于 2019-11-29 03:27:05
Is there an API for running Visual Studio Unit Tests programmatically? Running MSTests.exe with Process.Start() does not work in the current scenario. What I'm looking for is something like the NUnit SimpleTestRunner. Any ideas? /Erik You're correct in that there's no public API for the mstest framework. I wrote a manual replacement for mstest one day to see how hard it was, and it's not as simple as it looks (particularly if you want to take advantage of more than one CPU core), so beware of going down this path. Personally I've always just run mstest.exe programatically and then parsed the

Error debugging code in visual studio 2012 - Failed to initialize client proxy: could not connect to

自古美人都是妖i 提交于 2019-11-29 02:56:14
I am having Issues debugging unit tests in visual studio. I can run them fine from test explorer. The issue is that I cannot step into the code and debug. Also, I am able to debug other parts of the code that are not unit tests. When I right click on the test from test explorer and click debug I get a loading dialog saying "Loading symbols for vstest.executionengine.x86.exe from f:\biniaries\vset\mstestexecutor.x8g.csproj_1420192002\objr\x86". After a few more of these the test stops running and I get the following error displayed in the output window under "Tests". ------ Run test started ---

Teamcity running build steps even when tests fail

无人久伴 提交于 2019-11-29 02:55:24
I am having problems with Teamcity , where it is proceeding to run build steps even if the previous ones were unsuccessful. The final step of my Build configuration deploys my site, which I do not want it to do if any of my tests fail. Each build step is set to only execute if all previous steps were successful. In the Build Failure Conditions tab, I have checked the following options under Fail build if: -build process exit code is not zero -at least one test failed -an out-of-memory or crash is detected (Java only) This doesn't work - even when tests fail TeamCity deploys my site, why? I

Stepping through and debugging code in Unit tests

为君一笑 提交于 2019-11-29 02:04:45
问题 I have not been able to debug or step through unit test. Here is my sample test code... using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using DomainModel.Entities; using DomainModel.Abstract; using WebUI.Controllers; namespace Tests { [TestClass] public class PeopleControllerTests { static IPeopleRepository MockPeopleRepository(params Person[] people) { var mockPeopleRepos = new Moq.Mock