mstest

Unit Test Adapter threw exception: Unable to load one or more of the requested types

倾然丶 夕夏残阳落幕 提交于 2019-12-21 03:45:37
问题 I am attempting to run SpecFlow tests from the Visual Studio 2010 Command Prompt, and I am getting a rather obtuse error message: Unit Test Adapter threw exception: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.. Some info about my VS2010 Project setup: Windows 7 Enterprise, 64 bit (Version 6.1.7601 Service Pack 1 Build 7601) Visual Studio 2010 Premium (v10.0.40219.1 SP1Rel) Using Coded UI Tests Using SpecFlow 1.9.0, which

Why do async unit tests fail when the async/await keywords aren't used?

本秂侑毒 提交于 2019-12-21 03:34:15
问题 According to this discussion, there should be no difference between the following two methods: public async Task Foo() { await DoSomethingAsync(); } public Task Foo() { return DoSomethingAsync(); } Actually, it would seem that for very simple methods, the invocation without the async/await keywords would be preferred, as they remove some overhead. However, this apparently doesn't always work in unit tests. MSTest [TestClass] public class AsyncTest { [TestMethod] public async Task Test1() {

CollectionAssert use with generics?

大兔子大兔子 提交于 2019-12-21 03:23:09
问题 It appears that CollectionAssert cannot be used with generics. This is super frustrating; the code I want to test does use generics. What am I to do? Write boilerplate to convert between the two? Manually check collection equivalence? This fails: ICollection<IDictionary<string, string>> expected = // ... IEnumerable<IDictionary<string, string>> actual = // ... // error 1 and 2 here CollectionAssert.AreEqual(expected.GetEnumerator().ToList(), actual.ToList()); // error 3 here Assert.IsTrue

How do I tell MSTEST to run all test projects in a Solution?

老子叫甜甜 提交于 2019-12-21 03:17:22
问题 I need to know how to tell MSTEST to run all test projects in a solution file. This needs to be done from the command line. Right now I have to pass it a specific project file, I'm trying to get it to run from a SOLUTION file. I'm hoping this is possible, because in Visual Studio, hitting Ctrl+R, A, runs ALL tests in the currently opened solution. The way I've interpretted the help files, you have to pass in each DLL specifically. I want to run this from the command line from my CruiseControl

Assert.Inconclusive and IgnoreAttribute

孤街醉人 提交于 2019-12-21 03:15:23
问题 What is the right way to use Assert.Inconclusive and IgnoreAttribute in MS Unit test framework? We are using Assert.Inconclusive mainly for tests which are: Not implemented yet Somehow broken or incomplete = requires futher attention When test body is for any reason commented out We are doing this because: Inconclusive test can have message We want to see such tests in test results on TFS Our problem is that Inconclusive tests are marked as error in both TFS and Resharper. If we use

xUnit Equivelant of MSTest's Assert.Inconclusive

元气小坏坏 提交于 2019-12-21 03:14:12
问题 What is the xUnit equivalent of the following MSTest code: Assert.Inconclusive("Reason"); This gives a yellow test result instead of the usual green or red. I want to assert that the test could not be run due to certain conditions and that the test should be re-run after those conditions have been met. 回答1: One way is to use the Skip parameter within the Fact or Theory attributes. [Fact(Skip = "It's not ready yet")] public void ReplaceTokensUnfinished() { var original = ""; var expected = "";

In Visual Studio Test, how to make a playlist which automatically excludes certain tests?

孤人 提交于 2019-12-20 16:20:55
问题 Our team has Visual Studio 2012 Professional licenses (not Test Professional). We are developing a smallish web application, and we have both true unit tests which mock everything needed, and tests for the data layer. Each class of data layer tests creates the whole database from scratch and fills it with a prepared set of test data, so running them takes a long time. As a result, we are reluctant to do a "run all", and our unit tests (which are quick) are only used rarely. We are looking for

How to integrate NUnit tests into a TFS 2010 build

橙三吉。 提交于 2019-12-20 12:06:50
问题 What is the best way to integrate nunit tests into TFS 2010? Is it via generic tests or is there a better approach to running them? Ideally I'd like to have the granularity of one generic test per test assembly and have a way to surface the results in the TFS build report. 回答1: You can run nunit tests from command line and therefore you can automate these tests via your (Workflow) build template. Since there aren't a lot of custom build activities available for TFS 2010 yet, you could write

How to integrate MSTest in your TeamCity build process

痴心易碎 提交于 2019-12-20 10:06:10
问题 How do I run MSTest as part of my build process in TeamCity? What are the pitfalls? 回答1: This answer is specifically for TeamCity 7.1 on Windows, but may apply to other environments. In your TeamCity build configuration, on the General Settings page Artifact paths : Artifacts\MSTest => MSTest Create a new Command Linebuild step Custom script : if not exist Artifacts\MSTest mkdir Artifacts\MSTest Create a new MSTestbuild step List assembly files : **\bin\**\*.Tests.dll Results file : Artifacts

Can I test an ASP.NET MVC web project using Selenium from a unit test project in the same solution?

♀尐吖头ヾ 提交于 2019-12-20 05:25:08
问题 I have an ASP.NET MVC 5 web project, and I have an MsTest-based unit test project that uses Selenium to do some automated "browser" tests. Currently, I have to run the web project (in my local IIS Express) and then run the tests against that, but that has all kinds of restrictions. For example, I can only "run" the tests, I can't "debug" them. And clearly this doesn't play well with my continuous integration pipeline. Is there no way to have the tests spin up an instance of the website? (I