I have been trying to use the MenuItemTester but keep getting a NoSuchControlException. The menu has been created using a MenuStrip object in Visual Studio 2005. I am using the following code to select Tools->Options from the menu.
MenuItemTester myTester = new MenuItemTester("Tools");
MenuItemTester myTester2 = new MenuItemTester("Options");
Could you tell me how to use the MenuItemTester correctly.
I don't have any actual experience, so take my feedback with a little salt...
Is your menu item.Name property set to "Tools" or "Options"? I believe the first parameter to the testers should match the .Name property of the control to test.
Bart De Boeck
Anders is writing support for toolstrip items. Alpha 3 does not support this functionality, yet. Please watch out for alpha 4.
Sorry for the delay,
When can we expect a version with proper support for ToolStrip elements?
Bart De Boeck
There is a version in test now. The next beta with toolstrip support will probably be online next week.
To use the new ToolStripMenuItems you should use the ToolStripMenuItemTester instead of MenuItemTester.
look for alpha 4 relase.
I try to find the ToolStripTester Class in NUnitForms 2.0 alpha 5 to test several ToolStrip element. Can someone tell me (piece of Sourcecode) how to test those elements?
Excuse me, please. I had the old NUnitForms.dll in my References. Everything is okay! ;-)
Ok! Now I have another problem: I can start the MainForm of my app in NUnitForms without problems. But when I try to import a data file (inside the app), NUnit is crashing. With the Just-In-Time-Debugger I get the following StackTrace:
at System.Windows.Forms.Control.WaitForWaitHandle(WaitHandle waitHandle)
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object args)
and some more...
I think the reason is, that I start a new Thread to import the data. Has someone an idea, to resolve this problem?
The message is:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
are you testing something, expecting the data file to be read, but it hasn't because the thread is stlil going off?