Hi Dave,
Could you tell me what command line you are using to run your unit test?
From the exception stack you showed, it seems that you use a WebBrowser on
the form to be tested.
I create a Windows Application project named 'WindowsApplicationForTest'
and add a WebBrowser control on the form. I add a public method called
'Navigate' in the form to navigate a URL using the WebBrowser. Then I
create a unit test for the public method 'Navigate'.
The following is the sample code in my test.
// Windows Application project
public partial class Form1 : Form
{
...
public bool Navigate()
{
this.webBrowser1.Navigate("http://www.google.com");
return true;
}
}
// Test project
<TestClass()> _
Public Class Form1Test
...
<TestMethod()> _
Public Sub NavigateTest()
Dim target As Form1 = New Form1
Dim expected As Boolean
Dim actual As Boolean
expected = True
actual = target.Navigate
Assert.AreEqual(expected, actual,
"WindowsApplicationForTest.Form1.Navigate did not return the expected
value.")
End Sub
End Class
Then I double click the 'WindowsApplicationForTest.vsmdi' under the
'Solution Item' node in the Solution Explorer and create a new test list
named 'TestList1' under the 'Lists for Tests' node. Select the 'All Loaded
Tests' node and drag the 'NavigateTest' on the right panel onto the newly
created Test List 'TestList1'.
From the VS2005 Command Prompt, swith to the Solution folder and type the
following command:
MSTest /testmetadata:TestProject1.vsmdi /testlist:TestList1
The result is that the unit test is run properly without any exception.
If there's any difference between your test and mine, please let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.