mstest

How can I get Resharper to run tests in debug, when I get debug is “Inconclusive: Test not run”

与世无争的帅哥 提交于 2019-12-10 12:28:14
问题 How can I get Resharper to run tests in debug, when I get debug is "Inconclusive: Test not run" Running any MsTest test in Resharper test runner is Ok, but if I try to debug, the R# test runner just displays Inconclusive: Test not run This happens even with a simple test, e.g. [TestClass] public class BasicTests { [TestMethod] public void Placeholder() { Assert.AreEqual(1, 1); } } But the build-in test runner in Visual Studio works for both just running and for debug Additional info: It

Integration testing private classes and methods

南笙酒味 提交于 2019-12-10 11:26:54
问题 For unit testing you shouldn't test private methods, yes, but for integration tests (using a unit testing framework like MSTest or NUnit) I would very much like to run the internal API calls against a test url, to make sure the current code works when the third party API vendor changes their backend. Given the complexity of the system (stupid API's have hundreds of parameters) I have hidden most of it behind interfaces and IoC, with the API helper class completely internal to our data layer

how to run an mstest dll from command line

假装没事ソ 提交于 2019-12-10 10:35:15
问题 anybody knows how to run unit test dlls built using mstest from the command line, without running VS considering that on the machine there is .net 4.0 and VS2010 installed 回答1: I haven't done it myself, but I'd imagine that using the mstest command line is the way forward... if you've already tried that and had problems, please give more details. mstest /testcontainer:path\to\tests.dll EDIT: As noted in comments, you should either do this after putting the right directories on the path, or

Unit Test configuration for ASP.NET application

人走茶凉 提交于 2019-12-10 10:08:13
问题 This is my first test for Asp.Net Web Application. We have an Engine consisting of several modules. I need to test classes in Engine Module. Though these clases are part of Asp.Net App, they consists of only business logic. How can I test these classes in isolation other being part of WebApp ? because i am getting this error The Web request 'http://localhost:8936/' completed successfully without running the test. This can occur when configuring the Web application for testing fails (an ASP

Getting started with automated integration/unit testing in an existing code base

﹥>﹥吖頭↗ 提交于 2019-12-10 07:46:57
问题 Background: We have been handed over a very large codebase (1.4 million lines) that is primarily in C#. The application consists primarily of asp.net 2.0 style asmx web services accessing data in a SQL server 2008 database and also in various XML files. There are no existing automated tests in place. We have an automated nightly build in place (CC.NET). We want to introduce some level of automated testing, but refactoring in granular level unit tests for this amount of code seems unlikely.

Attribute filter syntax for code coverage in TeamCity

好久不见. 提交于 2019-12-10 03:26:40
问题 Anyone knows the syntax for excluding code from coverage in Teamcity? I am using the ExcludeFromCodeCoverageAttribute on certain methods and want those excluded. It works well in Visual Studio but I don't understand how to get the same behavior in TeamCity. The Field I am trying to configure is located in MsTest -> .Net Coverage -> Attribute Filters: I have tried this: -:ExcludeFromCodeCoverageAttribute and this -:ExcludeFromCodeCoverage 回答1: After trying out a few variations this worked: -

Verifying Mock method was called inside Task.Run

。_饼干妹妹 提交于 2019-12-10 03:19:26
问题 How can I verify that a method was called on a mock when the method itself is called in a delegate passed to Task.Run ? By time mock.Verify is called the Task still hasn't executed. I have tried await Task.Delay just before mock.Verify but this seems to leave the test runner hanging. The reason for using Task.Run is to offload the logic to prevent an attacker from being able to differentiate whether the email address exists in the system by the time to execute. using System.Threading.Tasks;

Build failing - VS2010 solution on TFS2008

跟風遠走 提交于 2019-12-10 03:17:07
问题 I have migrated a VS2008 ASP.NET MVC solution to VS2010/MVC2/.NET 4.0 The solution builds locally and all unit tests pass. Our TFS server is still TFS2008 and I am having problems getting the CI build to pass. The projects all build successfully, the unit tests all run and pass but the Running Tests item fails. I followed this blog post on how to get the build working and I'm almost there. Combing the log file for failures I have found the following: Test Run Completed. Passed 1101 ----------

MSTest exception: Unit Test Adapter threw exception: Type is not resolved for member

谁都会走 提交于 2019-12-10 03:12:22
问题 In my project I write tests using Microsoft's unit testing framework. All of my tests pass when I run them from Visual Studio but when I run the tests from MSBuild all of the tests fail with the following erorr message: Unit Test Adapter threw exception: Type is not resolved for member SomeType , SomeAssembly Version= assemblyVersion , Culture=neutral, PublicKeyToken=.. The assembly not found is a 3rd party assembly referenced by all of the projects. The build script is used by TFS so I've

Attach an image to a test report in MSTest

半腔热情 提交于 2019-12-10 02:59:00
问题 We are using Visual Studio 2010 connected to Team Foundation Server 2010 and we use MSTest to create our unit tests. Is it possible to attach an image to a test report, so when a test fails we can visualize something? This image can for example be a screenshot of the application for UI tests or a graph visualizing measurement data. 回答1: Use the TestContext.AddResultFile method: [TestClass] public class UnitTest { [TestCleanup] public void TestCleanup() { if (TestContext.CurrentTestOutcome ==