mstest

How to exclude classes from an OpenCover report

情到浓时终转凉″ 提交于 2019-12-08 18:08:12
问题 In generating coverage reports with OpenCover (and then generating an HTML report with ReportGenerator) for an MSTest suite, I am trying to exclude framework generated classes. In particular, classes generated under the project's namespace by a service reference. The command I am using to generate the XML files looks like: OpenCover.Console.exe -register:user "-target:MyProject.Tests.dll" -targetargs:"/testcontainer:MyContainer" -output:coverage.xml -mergebyhash -filter:-*.AWebService.* I

Create Unit test methods dynamically during runtime in MSTest

馋奶兔 提交于 2019-12-08 16:03:31
问题 Is there an equivalent of SuiteBuilder in MSTest? couldn't find one so far. I have a bunch of xml files, each to be seen as mapped to a test method. As there are 100s of these and to manually write tests for each of these, is not a good idea. So in nunit you could implement ISuiteBuilder and have the Test cases run dynamically and show up as those many test methods. I am looking for a way to do the same thing in MSTest. I've looked at DataSource attribute, but it caters to 1 datasource xml

No tests to execute msTest

廉价感情. 提交于 2019-12-08 15:09:10
问题 I'm trying to run .NET unit tests on the command line using MSTest My command is "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:"full path of dll" /resultsfile:TestResults.trx When run it returns Starting execution... No tests to execute. The unit test runs perfectly fine in VS 2012 IDE. What do I need to do to get it running on the cmd line please? 回答1: Try this: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe"

MS Test: Getting executing testlocation?

天大地大妈咪最大 提交于 2019-12-08 14:35:28
问题 How do I find the equivalent of a path to the executing assembly when running tests under MS Test in VS 2010? I need to know where the test is running from, so that I can set a relative path to a data file that it needs. I am trying to find the same sort of path to an executing test that I would get if I used System.Reflection.Assembly.GetEntryAssembly().Location on an executing assembly. Thanks for your help. 回答1: You can use TestContext.DeploymentDirectory to get the test deployment

Why does passing variables fails with error value type 'string' cannot be converted into 'string()'?

怎甘沉沦 提交于 2019-12-08 14:05:02
问题 I'm trying to create an automated test for some C# code using VB. Example: For the table Orchestra, i have 1 record for the organisation 1123, whereby user xxx has value for externalId = null and name is Charm White. So my test would be to check if expected externalId is null and the name is charm white for that user. However, when declaring variables of value type string[] externalIds in VB code, it gives error : value of type 'String' cannot be converted to 'string()' Here's the C# code to

Moles/VS2010 SP1 Issue - Error 32, exit code -1002 building mstest with Moles 0.94.51023.0

倖福魔咒の 提交于 2019-12-08 08:50:54
问题 Update 6/20/2011 I can only build the test project once or twice before getting this error. Moles is unusable for me until this is resolved. Deleting obj/bin and closing/reopening visual studio isn't practical. The Error Error 32 The command ""C:\Program Files\Microsoft Moles\bin\moles.exe" @C:\src\qp\mvc3\Solution\QP.Tests.Moles\obj\Debug\Moles\moles.args" exited with code -1002. QP.Tests.Moles The Description Was trying to use moles with nunit but had trouble... so I created a new mstest

Execute Test using updated .feature file without compilation

有些话、适合烂在心里 提交于 2019-12-08 03:18:37
问题 I want to be able to change my feature file from outside visual studio and have the updated feature file picked up, for subsequent test execution, without compilation of my test project. Is it possible to do this? Can someone help to specify the exact steps needed to do this? I am using MsTest. Here are the steps I followed, but I get the message "No tests to execute." every time: Change Test Project file (.csproj) as mentioned here Build the Test DLL from Visual Studio Kept the feature file

WPF - XamlParseException when unit testing method in Window class

谁说我不能喝 提交于 2019-12-07 21:01:43
问题 I'm trying to use MSTest to write unit tests for methods in my MainWindow class in my WPF application. However, I get the following exception: System.Windows.Markup.XamlParseException: 'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '127' and line position '32'. ---> System.Exception: Cannot find resource named 'verticalLineStyle'. Resource names are case sensitive. verticalLineStyle is found in a ResourceDictionary that is included in App.xaml . I

Access TestContext in SpecFlow Step Binding class

点点圈 提交于 2019-12-07 13:48:39
问题 Is it possible to access the MSTest TestContext from within a SpecFlow (1.7.1) step binding class? In the generated code of a feature file there is a method FeatureSetup which takes the TestContext as an argument but apparently doesn't do anything with it. 回答1: I found a way to pass parameters to TestContext and then access them from SpecFlow. By adding a [TestClass] which has a TestContext property and marking its AssemblyInit() method as [AssemblyInitialize] so it gets initialized early

Unit testing: Sending complex object as a input parameter to my test method using MSTest

帅比萌擦擦* 提交于 2019-12-07 12:44:33
问题 I'm trying to send a List<DataStatusItem> as a input parameter to my unit test method using DataRow attribute as below, [TestClass] public class UpdateProcessingTestController { private List<DataStatusItem> DataStatusItemsTestSetup = new List<DataStatusItem>() { new DataStatusItem { DataItemID = 1, DataItemCurrentStatusID = 1, DataItemStatusID = 1, DateEffective = DateTime.Now } }; private readonly Mock<IEmployee> moqEmployee; public UpdateProcessingTestController() { moqEmployee = new Mock