mstest

Can Selenium IDE generate tests in C# for MSTest

与世无争的帅哥 提交于 2019-12-06 11:04:55
问题 I have started using the selenium plugin for firefox for web automated testing. Is their a way when you generate the code for the tests in C# you can get it to create unit tests using MSTest instead of NUnit, which is the default. Not a biggie, but would be useful to know all the same. Thanks 回答1: At this time, no. The formatter only outputs NUnit code. However you may want to take a look at this blog, http://koenwillemse.wordpress.com/2011/02/16/custom-c-formatter-for-selenium/, which

DeploymentItem fails copying directories when there are multiple test projects per solution

一曲冷凌霜 提交于 2019-12-06 10:47:51
I have a number of test classes and methods that copy a particular directory like so: [TestClass, DeploymentItem("LanguageData", "LanguageData")] public class OcrTests { [TestMethod] public void Can_Capture_Field() { // some code that expects the LanguageData directory to be in the test results Out directory } // etc } [TestClass] public class OcrBuilderTests { [TestMethod, DeploymentItem("LanguageData", "LanguageData")] public void Can_Build_Specific_Ocr_Engine_Implementation() { // some more code that expects the LanguageData directory to be in the test results Out directory } // etc } Those

Running MsTest in Jenkins fails with CreateProcess error=5, Access is denied

℡╲_俬逩灬. 提交于 2019-12-06 10:36:29
问题 I am running MsTest as a Build Step from Jenkins but it fails with: [Test] $ "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE" /resultsfile:TestResult.trx /noisolation "/testcontainer:C:\Program Files (x86)\Jenkins\workspace\Test\UnitTestProject1\bin\Debug\UnitTestProject1.dll" Access is denied FATAL: MSTest command execution failed java.io.IOException: Cannot run program "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE" (in directory "C:\Program Files (x86)

Integration testing private classes and methods

夙愿已清 提交于 2019-12-06 07:29:34
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 library. I don't want to change this because it used to be public and we found the odd developer new to

WPF - XamlParseException when unit testing method in Window class

血红的双手。 提交于 2019-12-06 07:17:29
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 have no need of this style to test the method I'm trying to test, but I can't get past this. I'm just

Moving MSTEST classes into their own folders breaks “Create Unit Tests…”

岁酱吖の 提交于 2019-12-06 06:38:13
问题 I like to organize my unit test classes into functional areas using folders, much like the process I use to organize my application classes. However, the "Create Unit Tests" option in the right-click menu for a method breaks if the original target test class is moved to a new location, presumably because the code generator is trying to create a new class of the same name in the root of the Unit Tests project. I can fix the problem temporarily by moving the original test class into the root of

Integration Testing In Visual Studio With Different Project Types

廉价感情. 提交于 2019-12-06 03:39:49
We are in the middle of developing a new CRM, and it uses both WPF for local users, and a Windows Universal App (Store App) for the users in the field. The basic flow is this Customer calls in and gets scheduled on a field user in WPF app. Field user goes on service call and updates on Surface through Universal App. Customer gets billed from the WPF App. All the modules are in place and working, but I do not seem to be able to integration test the entire project flow due to the different Project Types. What I need to be able to do is add a reference to my Universal App in the unit test for my

MSTest TestMethod Dependency Injection

喜欢而已 提交于 2019-12-06 01:46:06
问题 I'm using a DI container and I want to do MSTest (VS 2010) unit tests with instances resolved from the container. I'd like to get these instances injected into my TestMethod or at least my TestClass. Is this possible? Right now my TestMethods directly call container.Resolve<T>(xxx) which I'd prefer to avoid so that my injection testing is more realistic. Anyone have experience with this? Thanks in advance. 回答1: The instantiation of the test class happens deeply in the internal classes of the

MsTest, DataSourceAttribute - how to get it working with a runtime generated file?

≡放荡痞女 提交于 2019-12-06 01:37:20
问题 for some test I need to run a data driven test with a configuration that is generated (via reflection) in the ClassInitialize method (by using reflection). I tried out everything, but I just can not get the data source properly set up. The test takes a list of classes in a csv file (one line per class) and then will test that the mappings to the database work out well (i.e. try to get one item from the database for every entity, which will throw an exception when the table structure does not

Access TestContext in SpecFlow Step Binding class

元气小坏坏 提交于 2019-12-06 00:35:12
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. 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 before runnig the tests and MSTest will be able to populate the TestContext. { [TestClass] public class