mstest

DeploymentItem behaving differently in VS2010 and VS2012

浪尽此生 提交于 2019-12-04 19:19:47
问题 I have a VS2010 solution that I'm trying to upgrade to VS2012. I'm having a problem with the MSTest unit tests in VS2012. All of the tests include DeploymentItem attributes on the test class. [TestClass] [DeploymentItem(@"SubDir\SubDir2\models", "models")] public class UnitTests { ... } In 2010, it's correctly copying dependent files from the SolutionDirectory\SubDir\SubDir2\models directory. In 2012, it's attempting to copy from the directory where the tests are deployed SolutionDirectory

Buildserver can not find Entity Framework Sql Provider

梦想与她 提交于 2019-12-04 18:43:42
问题 We are in the process of switching from Entity Framework 4 to Entity Framework 6. The package manager did its job, and the solution ran it’s tests without a hitch. However on the build server we get the following error message running the tests: Initialization method xxx.SetUp threw exception. System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO

Integration Test For Hosted Service .Net-Core`

不打扰是莪最后的温柔 提交于 2019-12-04 17:48:17
问题 I have a QueueTask Hosted service (.Net-Core's new background service) that I'd like to test. My queuedHosted service looks like so: public QueuedHostedService(IServiceProvider serviceProvider, IBackgroundTaskQueue taskQueue, ILoggerFactory loggerFactory) { TaskQueue = taskQueue; _logger = loggerFactory.CreateLogger<QueuedHostedService>(); _serviceProvider = serviceProvider; } protected async override Task ExecuteAsync(CancellationToken stoppingToken) { using (var scope = _serviceProvider

How do you get the iteration / line number from TestContext in data driven tests?

旧巷老猫 提交于 2019-12-04 17:02:42
问题 I've implemented a data driven test using MsTest framework. I was wondering if there was a way to get the iteration / line number of the current test code from the TestContext object? As far as I can see, the only property relevant to DDT is DataRow that enables getting info for the current iteration from the data source, but I don't see any property that gives me what I need. 回答1: Try this: int currentIteration = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow); 回答2: private

Can Selenium IDE generate tests in C# for MSTest

£可爱£侵袭症+ 提交于 2019-12-04 16:39:13
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 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 creates a custom formatter using MSTest. 来源: https://stackoverflow.com/questions/5236230/can-selenium-ide

Is defining TestMethod's in test base classes not supported by MsTest?

三世轮回 提交于 2019-12-04 15:23:24
问题 This question concerns a general unit test technique with a potentially very useful wide range of applicable scenarios. But it is easier to understand with an example to illustrate my question better. Let's say I want to test that all types that override Equals() does so correctly. Since Equals() is defined as virtual in System.Object , a wide range of types may change that behavior. Each type that does so, will have to have tests to make sure that the new behavior follows the implicit

How to set test category for all tests in the class

青春壹個敷衍的年華 提交于 2019-12-04 14:57:48
问题 I am using MSTest, and I want to set the same test category for all methods in test class at once, without setting TestCategory attribute to each method individually. How can this be done? The most convenient and obvious way would be to set TestCategory attribute on class, but it can be applied to methods only. The ultimate goal is to skip integration tests during test run on TFS check-in. 回答1: To be able to set the [TestCategory] attribute at the class level, install the “MSTest V2”

Couldn't run tests after updating TestFramework in NuGet

梦想的初衷 提交于 2019-12-04 12:59:45
An exception occurred while invoking executor 'executor://mstestadapter/v2': Constructor on type 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner' not found. Exit Visual Studio. Delete %temp%\VisualStudioTestExplorerExtensions Restart Visual Studio and try again. That's all it was. I had the same problem while running tests in the build server. I tried below things and it started working: updated my projects to point to latest MSTest.TestAdapter and MSTest.TestFramework cleared old versions of MSTest.TestAdapter and MSTest.TestFramework folders from build server

How to get test result status from MSTest?

本秂侑毒 提交于 2019-12-04 12:42:35
In NUnit, I can get the test result from context.Result.State . If its NUnit.Framework.TestState.Success , then I know the test passed. In MSTest, how do I get that info? I saw context.Properties.Keys , but none of them speak of the status of the test result. Use the TestContext.CurrentTestOutcome property in the TestCleanup method: [TestClass] public class UnitTest { private TestContext TestContext { get; set; } [TestCleanup] public void TestCleanup() { if (TestContext.CurrentTestOutcome == UnitTestOutcome.Passed) //do something } [TestMethod] public void TestMethod() { } } 来源: https:/

Getting MSTest output to show in CruiseControl.Net

北城以北 提交于 2019-12-04 08:12:47
问题 I currently have our build server set up with CruiseControl.Net running a build using MSBuild and then running unit tests using MSTest. The problem is I can't see the output of the unit tests in CC - I know they are being run because I can get the build to fail if I commit a failing test. I have followed the online guides from http://blogs.blackmarble.co.uk/blogs/bm-bloggers/archive/2006/06/14/5255.aspx and http://www.softwarepassion.com/?p=89 but still having no luck. My ccnet.config file