Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Unit Test failure to start

I am having an issue when starting the tests under debug mode in Visual Studio 2008 Team Test where it gives the following error:

"Failed to queue test run '{user@machinename}': Object reference not set to an instance of an object."

I googled for the error but no joy. Don't even understand what it means as it is too brief. Has anyone come across this?

Note that I can run tests fine if I am not debugging and I get the same error irrespective of the test I run.

Thank you,

Swati

ETA:

Being new to Visual Studio Team Test, I didn't know there was a better exception log then what I was seeing. Anyhow, here it is:

<Exception>
System.NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.
ShowToolWindow [T](T&amp; toolWindow, String errorMessage, Boolean show)

at Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.
OpenTestResultsToolWindow()

at Microsoft.VisualStudio.TestTools.TestCaseManagement.SolutionIntegrationManager.
DebugTarget(DebugInfo debugInfo, Boolean prepareEnvironment)

at Microsoft.VisualStudio.TestTools.TestManagement.DebugProcessLauncher.Launch(
String  exeFileName, String args, String workingDir, 
EventHandler processExitedHandler, Process&amp; process)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.StartProcess(
TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.RestartProcess(
TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.PrepareProcess(
TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.
InitializeController(TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.QueueTestRunWorker(
Object state)
</Exception>
like image 709
swmi Avatar asked Feb 22 '10 15:02

swmi


People also ask

How do I run a unit test in Visual Studio?

Tests can be run from Test Explorer by right-clicking in the code editor on a test and selecting Run test or by using the default Test Explorer shortcuts in Visual Studio. Some of the shortcuts are context-based. This means that they run or debug tests based on where your cursor is in the code editor.

How do I run unit tests in debug mode?

To start debugging: In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.

How do I run a unit test in Visual Studio python?

Open a Python project. Once the project is loaded in Visual Studio, right-click your project in Solution Explorer and select the unittest or pytest framework from the Properties Test tab. If you use the pytest framework, you can specify test location and filename patterns using the standard pytest .


1 Answers

You may be running into a (little) known bug caused by lower case characters in the computer name when using the VS 2008 test engine; see here for some info on it. It took us weeks to figure it out on one of my projects, and it still isn't easily found in documentation anywhere that I can find.

The problem is in the VS test engine and occurs if the computer name contains any lower-case letters. The test engine converts the computer name to all upper case letters when running, which causes an internal string comparison to fail and leads to similar error messages to what you are describing.

You may or may not be having the same problem, but if your computer name has any lower case letters, try changing the name to an all upper case version and then see what happens....

like image 152
KP Taylor Avatar answered Oct 19 '22 07:10

KP Taylor