mstest

How to write output from a unit test?

有些话、适合烂在心里 提交于 2019-11-27 17:19:20
Any call in my unit tests to either Debug.Write(line) or Console.Write(Line) simply gets skipped over while debugging and the output is never printed. Calls to these functions from within classes I'm using work fine. I understand that unit testing is meant to be automated, but I still would like to be able to output messages from a unit test. frennky Try using TestContext.WriteLine() which outputs text in test results. Example: [TestClass] public class UnitTest1 { private TestContext testContextInstance; /// <summary> /// Gets or sets the test context which provides /// information about and

Teamcity running build steps even when tests fail

时光总嘲笑我的痴心妄想 提交于 2019-11-27 17:14:01
问题 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

Deleting database from C#

喜你入骨 提交于 2019-11-27 16:07:59
问题 I have a MDF file that I'm attaching to my local SQL server during testing with MSTEST and I don't want to have to go delete those temporary databases by hand after I've run the test set 50 times. (I've already done that and I don't like it >.<) I'm look for a way to delete the database from the server after I'm done with the tests, during my TestCleanup method. I just need a little guidance on what SQL statements I would use to do this. Thoughts? Thx in advance! :D EDIT (By Software Monkey,

In MSTest, How can I verify exact error message using [ExpectedException(typeof(ApplicationException))]

两盒软妹~` 提交于 2019-11-27 15:47:25
问题 Using MSTest how can I verify the exact error message coming from a test method? I know [ExpectedException(typeof(ApplicationException), error msg)] doesn't compare the error message coming from my test method, though in other unit test framework it is doing. One way to solve this problem is to write my unit test using some try catch block, but again I need to write 4 lines more. Is there any smartest way to check the error message. Cheers, Pritam 回答1: You can create your own

Error trying to run mstest on jenkins

落爺英雄遲暮 提交于 2019-11-27 15:45:35
问题 I´m trying to configure MSTest build plugin on jenkins, but I´m getting the following error: Path To MSTest.exe: mstest.exe Result file was not found so no action has been taken. file:/C:/Program%20Files%20(x86)/Jenkins/jobs/SoftwrenchvNext/workspace/TestResult.trx FATAL: null java.lang.NullPointerException at org.jenkinsci.plugins.MsTestBuilder.perform(MsTestBuilder.java:144) The configuration simply specifies TestResult.trx as ResultFileName. This file is not versioned, and I expect it to

How Does MSTEST/Visual Studio 2008 Team Test Decide Test Method Execution Order?

耗尽温柔 提交于 2019-11-27 15:32:17
I was under the impression that the test methods in a unit test class would be executed in the order that they appear in the class file. Apparently this is not true. It also doesn't appear to be purely based off of alphabetical order either. How does MSTEST decide execution order? EDIT: I was able to track down the answer after digging a bit. See below. I was able to track down the answer. According to Microsoft employee Guillermo Serrato : MSTest executes all tests synchronously, the order is nondeterministic beetleaz This is actually simply to do: use this link How to: Create an Ordered Test

Parse Fitnesse RESTFul XML output into TFS Test format

≯℡__Kan透↙ 提交于 2019-11-27 15:25:45
问题 I'm integrating a Fitnesse Acceptance test suite into a TFS based CI process. I can run the Fitnesse Test suite in a RESTful manner (http://fitnesse.org/FitNesse.UserGuide.RestfulTests): http://myfitnesseserver/MyTestSuite?suite&format=xml and get back an XML document of test results. I'd like to transform that into a format that TFS can interpret as number of tests passed / failed. Any pointers? Thanks 回答1: I have a similar goal at work, so I created a generic command-line Fitnesse test

Test run errors with MSTest in VS2010

时光毁灭记忆、已成空白 提交于 2019-11-27 15:00:20
问题 When I run my Unit Tests, all tests pass, but instead of "Test run succeeded" or whatever the success message is, I get "Test run error" in the little bar that tells me how many of my tests pass, even though all my tests passed. When i click the text, I'm taken to a page that tells me the following two things happened: Warning: conflict during test run deployment: deployment item '[...]\Booking.Web.dll' directly or indirectly referenced by the test container [...]\Booking.Web.Tests.dll cannot

MSTest and app.config issue

时间秒杀一切 提交于 2019-11-27 13:29:47
问题 I am stuck trying to automate unit tests runs with MSTest and deployment of app.config. I read multiple posts and blogs, tried multiple things and yet still app.config doesn't seem to be picked up during MSTest execution. Having a dll that contains all my unit tests built with msbuild, here is what I've tried... Attempt 1 Copied app.config to the same location with MyTests.dll as MyTests.dll.config (on one of the msdn forums it was said it'd be picked up automagically) Added [DeploymentItem(

Running mstest from command line against Visual Studio 2012 native C++ tests

青春壹個敷衍的年華 提交于 2019-11-27 12:08:02
问题 I have a Visual Studio 2012 Solution with a number of native c++ test projects. I can run all of these correctly and successfully from within Visual Studio 2012 using the Test Explorer tab. However, I cannot get the tests to run when running from the command line. Following the documentation I have been running the following command line mstest /testcontainer:PathToTestProject\Win32\Release\testproject.dll I also need to run mstest /testcontainer:PathToTestProject\x64\Release\testproject.dll