mstest

MSTest - Run “LoadTests” and Write Results to SQL Server Database

假如想象 提交于 2019-12-04 02:15:44
问题 If you want to configure your VS "Load Tests" to write the results to a database server, you use the following instructions. If you want to run your "Load Tests" through powershell on a separate machine(think TFS 2018 release step), you use the following instructions. I would like to do both, on multiple machines, in a automated manner, but there's not a great deal of documentation on this, I can run my tests like this: .\mstest /testcontainer:"C:\XXX\ABC.loadtest" But the results are kicked

Simulate a delay in execution in Unit Test using Moq

拈花ヽ惹草 提交于 2019-12-04 01:34:45
I'm trying to test the following: protected IHealthStatus VerifyMessage(ISubscriber destination) { var status = new HeartBeatStatus(); var task = new Task<CheckResult>(() => { Console.WriteLine("VerifyMessage(Start): {0} - {1}", DateTime.Now, WarningTimeout); Thread.Sleep(WarningTimeout - 500); Console.WriteLine("VerifyMessage(Success): {0}", DateTime.Now); if (CheckMessages(destination)) { return CheckResult.Success; } Console.WriteLine("VerifyMessage(Pre-Warning): {0} - {1}", DateTime.Now, ErrorTimeout); Thread.Sleep(ErrorTimeout - 500); Console.WriteLine("VerifyMessage(Warning): {0}",

wildcard test containers to mstest. exe

十年热恋 提交于 2019-12-04 01:03:51
Is it possible to pass wildcard testcontainer values to the command-line mstest.exe rather than manually hardcoding multiple testcontainer values? Such as Mstest.exe /testcontainer: tests .dll I'm wanting to manually invoke mstest in our tfs 2012 upgrade template.xaml build processso tthat it behaves like a autodiscovery way similar to running tests in default template.xaml If not could this be written into a bat script to loop through folders from a given start folder? oɔɯǝɹ MSTest doesn't take a wildcard parameter for the testcontainer ( look here for a reference on the command line options

Multiple Asserts in a Unit Test [duplicate]

六月ゝ 毕业季﹏ 提交于 2019-12-04 00:29:34
This question already has answers here : Closed 2 years ago . Is it bad practice to have more than one assertion in a unit test? [closed] (8 answers) I've just finished reading Roy Osherove's "The Art of Unit Testing" and I am trying to adhere to the best practices he lays out in the book. One of those best practices is to not use multiple asserts in a test method. The reason for this rule is fairly clear to me, but it makes me wonder... If I have a method like: public Foo MakeFoo(int x, int y, int z) { Foo f = new Foo(); f.X = x; f.Y = y; f.Z = z; return f; } Must I really write individual

Unit Test Description question

大城市里の小女人 提交于 2019-12-03 23:35:20
There is a description entry for Unit Tests in Visual Studio. Is it possible to modify a test description after creation? [TestMethod] [Microsoft.VisualStudio.TestTools.UnitTesting.Description("Test Case Description")] public void EnsureTestCaseValid() { } The Description column in the Test View is readonly, but if you select a test and look in the Properties window, you'll find that the Description property is editable. This will add a [Description("string")] attribute to the test. 来源: https://stackoverflow.com/questions/7112811/unit-test-description-question

Resharper 7: MSTest not working - “Test wasn't run”

夙愿已清 提交于 2019-12-03 23:34:22
Since I upgraded to VS2012 and Resharper 7, my previously working MS Tests are not running anymore. The tests are run in an ASP.NET environment. I use the following Attributes: [TestMethod] [HostType("ASP.NET")] [AspNetDevelopmentServerHost("C:\\Projekte\\****\\Website", "/")] [UrlToTest("http://localhost:7924/")] Any idea how to fix this? As odd as it is, using VS2012, using Resharper 8.0, using NUnit, I was receiving this error because of an entry in my app.config file. I added an EntityFramework connection string and this behavior started. Removing the entire connection strings section

Using both MSTest and NUnit?

偶尔善良 提交于 2019-12-03 23:26:38
Reading about MSTest and NUnit I couldn't really decide what to use in my project. We use TFS 2008 and VS2010. I like MSTest because of its integration into VS2010, Continuous Integration and Code Coverage reports. I like NUnit because it allows to formulate complex assert statements in a nice, readable fashion. Stumbling upon http://alsagile.com/archive/2010/03/09/stop-the-war-between-nunit-and-mstest-make-them.aspx I ask the community: is it possible to use both? I also think about sticking to MSTest and use Fluent Assertions to give me a more flexible way in formulating assert statements.

Your project does not reference “.NETFramework,Version=v4.6.2” framework. Add a reference to “.NETFramework,Version=v4.6.2” in the “TargetFrameworks”

别来无恙 提交于 2019-12-03 22:02:39
I can't run my unit tests. I have the next error: Your project does not reference ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "TargetFrameworks" property of your project file and then re-run NuGet restore. In app.config : <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/> </startup> In Project > Properties > Application > TargetFramework (.NET Framework 4.6.2) How can I fix it? Please make the next steps Clean solution Clean folder "packages" Delete folder "bin" Delete folder "obj" I up-voted Larissa but I

MSTest Not Finding New Tests

拟墨画扇 提交于 2019-12-03 18:01:21
问题 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. 回答1:

VS 2013 MSTest vs nUnit vs xUnit

我怕爱的太早我们不能终老 提交于 2019-12-03 16:52:00
问题 I realize there have been a LOT of questions on this topic but somehow I haven't found one that addressed my needs. My team is looking to start automated Unit testing our application. We have never done it before and nobody on the team has much experience with it. I have been asked to research and find a framework for automating our Unit Testing. So far, I have narrowed the choices down to MSTest, NUnit and xUnit . All across the internet, I read negative reviews about MSTest but it seems the