mstest

obtain command line arguments in unit test

天涯浪子 提交于 2019-12-13 16:25:56
问题 In a Test project in Visual Studio 2008 (Pro), I created a Test project, and I want to configure the project properties to give a command line argument to the tests. I set the properties, but then realized I have no idea how to actually use the argument. How do you get the arguments from MSTest? 回答1: VS 2008 test are compiled into DLLs which can't directly receive command line arguments as far as I know. You could add a configuration file 'app.config' for the dll and use that instead. Just

Using MVCContrib.TestHelpers with MsTest - is there any way to get nicer fail messages?

假装没事ソ 提交于 2019-12-13 16:13:24
问题 I'm just starting to use MVCContrib, and I'm really liking the syntactic sugar it adds to various test scenarious. For example, I just wrote this assertion: "~/".Route().ShouldMapTo<SpotController>(c => c.List()); It's brilliant! Well, almost... Instead of, as I'd like, seeing the actual reason why the test fails (I've changed nothing in my MVC application, so that should route to HomeController.Index() ) I get the generic message about an exception being thrown during test execution. This is

What is needed to execute visual studio 2005 web tests?

亡梦爱人 提交于 2019-12-13 16:06:37
问题 Our test department has a series of web tests created using Visual Studio 2005 Team Tester Edition. I would like to be able to execute these tests against my local machine. I attempted to use the mstest command line tool to accomplish this as described in this MSDN article. But I get the following error: C:\WebTests\Participant>mstest /testcontainer:AE_ActivityDue_Touch.webtest Microsoft (R) Test Execution Command Line Tool Version 9.0.30729.1 Copyright (c) Microsoft Corporation. All rights

How to mock Application.Current for unit-testing?

泄露秘密 提交于 2019-12-13 15:04:59
问题 I have this: <Image.Effect> <fx:GrayscaleEffect DesaturationFactor="0"/> </Image.Effect> and this: public class GrayscaleEffect : ShaderEffect{ private static PixelShader _pixelShader = new PixelShader() { UriSource = new Uri(@"pack://application:,,,/Effects/GrayscaleEffect.ps") }; /* ... rest of the class ... */ } When I unit-test it ( MSTest ), it obviously raises IOException (since Application.Current is null, so pack://application:,,,/... points to nowhere) with this error: Assembly

Visual Studio Team Test: How to unit test “?” operator with only Asserts() and not using any tool

喜欢而已 提交于 2019-12-13 12:44:05
问题 I need to write some unit test cases to test my code in C# Visual Studio Team Test framework. Below is the method I want to test: public static ObjectID CreateObjectID(ObjectID xrmObjectID) { return new ObjectID { Id = xrmAssociation.ID != null ? xrmAssociation.ID.Id : Guid.Empty; }; } In the above method, I need to write unit test cases to cover the conditional statements, for example: Id = xrmAssociation.ID != null ? xrmAssociation.ID.Id : Guid.Empty; So I wrote the following unit test

MSTest: how to increase test time

心已入冬 提交于 2019-12-13 12:24:12
问题 I have one test that needs to work more then 1 minute (VS2008, MSTest, tests are launched from the VisualStudio): const int TestTimeout = 1; [TestMethod] [Timeout(10*60*1000)] // 10 minutes public void Login_ExpirationFail_Test() { IAuthenticationParameters parameters = new AuthenticationParameters(...); LdapAuthentication auth1 = new LdapAuthentication(); IAuthenticationLoginResult res = auth1.Login(parameters); Assert.IsNotNull(res); Assert.IsFalse(string.IsNullOrEmpty(res.SessionId));

How to run Coded UI Tests without Visual Studio 2010 Premium [closed]

狂风中的少年 提交于 2019-12-13 06:32:59
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I want to ask you if it is possible to build and run coded ui tests without Visual Studio 2010 Premium installed? Or can I just install Visual Studio 2010 Premium and use it command line without licensing? I know it works, but is the license ok with that? 回答1: Nope, you would need to license it. If you want to

MSTest data driven rows are cast to ints

痞子三分冷 提交于 2019-12-13 06:20:28
问题 I have a data driven test (using MSTest) that has inputs that look like this: ValuesToInput,ExpectedValue 0,0 00,00 000,000 0000,000 00000,000 000000,000 When I pull those out of my TestContext they are just 0. It has converted my string of 0000 to an int and gives me 0. How can I make it give me my values as strings? NOTE: My test method is setup like this: [TestCategory("CodedUI"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "MyCvsFile.csv", "MyCvsFile#csv",

Task Scheduler not executing batch (bat) file with MSTest commands

左心房为你撑大大i 提交于 2019-12-13 05:54:24
问题 I have several batch files which set a log file path and start visual studio 2010 ordertests. When I execute a batch file from windows explorer it runs perfectly. The problem is that when I use the Windows Task Scheduler to run a batch file my orderedtest is not executed. Sample Code: ::: ::: This batch kicks off the searchinlineset test set node. ::: SetLogPath.vbs "\\spm08r2dw\ATPData\Webportal Test Results\" %comspec% /c "call "%VS100COMNTOOLS%vsvars32.bat" & mstest /testcontainer:"

How do I write a test to verify Entity Framework Database First Model

China☆狼群 提交于 2019-12-13 05:11:04
问题 I have a Entity Framework Database First Model. I want to write a MSTest/nUnit test to verify that all the Stored procs and tables that are defined in my edmx model are still valid on the database. With a large team of developers some only working on stored procedures and other in c# I would like to run an integration test to validate/verify the EF models in the project. I had a test in Linq2Sql to look for an attribute that is common on the stored procedure calls then it ran a SQL Query to