When I run the unit tests, Visual Studio throws following exception
Exception of type 'System.Exception' was thrown.
Even it's not possible to run any of the tests, which means it's a setup issue with Visual Studio. Any workaround/solution for this?
Check if your UnitTest project has an invalid reference to another project (e.g. a project which has been deleted, or project type has changed from "library" to "utility").
Related
I'm getting the following error when trying to run a coded ui test from MTM:
Unit Test Adapter threw exception: Method not found: 'Void Microsoft.VisualStudio.TestTools.UITest.Extension.UITestUtilities.AddAssemblyResolveHandler()'..
All I'm looking for is a hint as to why this is happening, my project references look like this:
I'm using Visual Studio 2013 Update 4, The Test Controller and Agent too are 2013 Update 4.
I can queue a build, but when I try and run a test against the build using MTM, I get this error.
EDIT, Also using net 4.5.1.
EDIT 2: Everything runs locally in dev environment when tests are kicked off from Visual Studio. It's once I kick off the tests through MTM -> Controller -> Agent where the problem persists. The exact same message is thrown regardless of the test.
Check if the test run has all the necessary dlls in the test run directory, in the machine where test controller runs check the directory
"C:\Users\ username \appdata\Local\VSEQT\QTController\ testrunid \Deployment\"
I have been working with creating a brand new test projects in VS 2010 tonight. Immediately after creating the project which VS 2010 supplies with a test file to show me how to work with it's attributes, I build and get the following:
Error loading ...my documents\visual studio
2010\Projects\TestProject1\bin\Debug\TestProject1.dll: Could not load
file or assembly ...\my documents\visual studio
2010\Projects\TestProject1\bin\Debug\TestProject1.dll' or one of its
dependencies. Operation is not supported. (Exception from HRESULT:
0x80131515)
I don't have any dependencies or references. Why can't I build a test project in VS immediately after creation?
It might be a network permissions issue on where your project files were being saved.
Just saving stuff locally will fix your problem. Maybe!
Or you can try Unblocking Any Protected Files
I'm trying to run MSpec tests in Visual Studio's test system using Gallio, but it appears to be ignoring the MSpec plugin from the IDE. What I did:
Installed Gallio
Added the MSpec NuGet package to my test project
Added the Gallio NuGet package to my test project
Copied the three files required for the MSpec Gallio integration to an "MSpec" folder in Gallio's installation directory
Wrote an MSpec test
Ran "All Tests in Solution" in the IDE
This yielded the following error
"No tests were run because no tests are loaded or the selected tests are disabled"
To check Gallio itself, I added a reference to MbUnit and created a simple MbUnit test. I also ran Gallio's other tools to check if the plugin was being picked up at all. I even restarted VS for good measure.
Results
Running the tests using Gallio.Echo or Gallio.Icarus successfully executes both MbUnit and MSpec tests, so the plugin is being picked up. Running the tests from Visual Studio runs the MbUnit test but not the MSpec test, so Gallio integration appears to be working (just not the MSpec plugin). Any thoughts?
Before anyone mentions it: yes, I'd rather be using ReSharper but licenses are not an option for my situation at the moment.
Update: The is now a project to integrate MSpec into VS2012's test system. It's available on the Visual Studio Gallery and the source is on GitHub.
After starting to debug the problem with both project's sources, it appears there are two underlying issues causing the incompatibility between MSpec and Gallio's VS runner. However, both issues stem from the fact that the VS runner uses Cecil to load type information from assemblies (presumably to avoid loading the test assembly into the main VS AppDomain).
I'll update this answer as I uncover more (hopefully resulting in one or more patch to fix the issues).
Issue 1: Nested types are ignored
I had been using nested types for my tests (SubjectSpec+when_something), which are ignored by the Cecil-based reflection used by Gallio's VS runner to avoid loading the test assembly into the app domain.
This ended up being a relatively simple fix, which I've submitted as a patch to the Gallio developers. I'll update this answer if/when I get confirmation of which release it will be part of.
Issue 2: MSpec causes "An exception occurred while invoking a test driver"
If the container type is removed to avoid issue 1, MSpec throws this error. The reason for this is that MSpec is trying to create an instance of the test object, but Gallio is only supplying it a wrapper Type object that can't actually be created.
I am attempting to install Visual Studio 2010 Agents for Test Controller / Test Agents so I can create Load Tests on my local machine. When attempting to install the Test Controller I recieve the following message in the configuration summarry
From the installation log I found the following error messages:
The existing connection string for controller MyComputerName:6901 is {this is blank}
System.MissingMethodException: Method not found: 'Boolean
Microsoft.VisualStudio.TestTools.WebStress.LoadTestDatabaseCounterWriter.IsDatabaseUpgradeFromRTMNeeded(System.Data.SqlClient.SqlConnection)'.
at
Microsoft.VisualStudio.TestTools.ConfigCore.TestControllerHelper.CreateAndUpgradeLoadTestSchemaIfRequired(String
loadTestConnectionString, String directoryContainingSchemaFile) at
Microsoft.VisualStudio.TestTools.ConfigCore.ControllerConfiguration.UpdateLoadTestDatabase(ControllerConfigurationUpdatePack
updatePack, DelegateStatusUpdate statusListener)
Failed to configure load test database.
Problem solved!
Briefly, only Visual Studio 2010 Service Pack 1 is missing, and a DLL doesn't contain a method that is invoked by the Test Controller Configuration Tool.
Solution: install VS 2010 Service Pack 1.
Reason: Microsoft.VisualStudio.QualityTools.LoadTest.DLL does not contain a Database checker method that is invoked by the configuration tool, so an exception is thrown, and the configuration is failing. After upgrading to SP1, the DLL updates successfully and the missing method can be found there.
I'm developing a Visual Studio Integration Package. When I try to run the Unit Tests that are included in the unit test project that is included in the template I get the following failure on the first test:
The test adapter 'VsIdeHostAdapter'
threw an exception while running test
'MenuItemCallback'. Call was rejected
by callee. (Exception from HRESULT:
0x80010001 (RPC_E_CALL_REJECTED))
It's intermittent- a new instance of Visual Studio always spins up, then sometimes it works but usually fails.
Turns out this is a known issue- the built-in tests have some problems.