I am currently porting my UI tests to CodedUI Tests. Now I am facing the following problem:
In my UnitTest, I call the method located in my UIMap twice. The method contains a fragment that checks whether the MessageBox window is open and has a logical parameter that switches whether to press the confirm or cancel button in the message window. Messagebox never changes (this means its name, text, buttons).
public void MyUiMethod(bool p)
{
ApplicationUnderTest app = ApplicationUnderTest.Launch(@"some.exe");
try
{
Assert.AreEqual(true, uImessageBoxWindow.Exists);
if (p)
Mouse.Click(uIConfirmButton, new Point(39, 16));
else
Mouse.Click(uICancelButton, new Point(49, 8));
}
finally
{
app.Close();
}
}
The first call works without problems every time. During the second call, a Messagebox pops up, but cannot be detected by the test environment.
The search criteria assigned by CodedUiTestBuilder to the MessageBox is its name (information) and class name (# 32770).
- , ? MessageBox?
,