I've Googled and Binged and Yahoo'd and even Dogpiled. I found mostly Python, PHP, and Ruby that don't apply. Only one item shows up (from 2012) but it has no answer: unit test fails in r# but passes in mstest
I have two tests that work exactly as recorded. For one, when the test gets to the Submit button, the app says the page isn't ready to be submitted and the Submit button remains disabled. For the other, the Submit button is enabled, but the page does nothing. When I run the exact same actions manually (using keyboard and mouse) with identical data (or with different data), the Submit buttons on both pages work and both pages process.
I've run the tests to the point where the Submit buttons are clicked, but nothing happens when I manually click them, either. I've tabbed from one field to the next thinking it might be an event not firing, but no.
Here's what I've found: If the automation opens the page, the Submit buttons will not work. If even one item on the page is entered or selected by the automation, the Submit buttons will not work. BUT: If I run the automation to the point BEFORE the page opens, then if I click to open the page and manually keyboard and mouse the entries, and then manually mouse-click the Submit button, it will work.
The tests were recorded in MTM and imported into Visual Studio 2012. I've tried re-importing them, and I've manually recorded the steps using Visual Studio.
We're now thinking there's some unexpected interaction between the testing software (MSTest) and the JavaScript in the pages. We've coded (Coded UI) 11 other pages in the application. All 11 application pages use the same basic architecture and the same controls. We testers are thinking the JavaScript might be broken (missing closing brace, missing pair of parentheses, missing a semi-colon, a line-break in the wrong place, something).
There is absolutely nothing unique about these tests. They are among the simplest tests I've ever coded. One of them only has four input fields. I've coded nothing manually; The UIMap.cs file is empty. It's all in the UIMap.Designer.cs based on the UIMap.UITest file.
Here is the significant portion of my Coded UI Test Class (variable setup and try-catch logic omitted):
try
{
User.OpenBrowser(TestContext);
this.UIMap.ClickFeesButtonInSecondaryMenu();
this.UIMap.ClickAddPaymentButton();
this.UIMap.OpenYearDropdownAndSelect2016();
this.UIMap.Type1234InCheckNumber();
this.UIMap.Type275InTotalAmount();
this.UIMap.SelectBusinessFees();
this.UIMap.SelectInstructorFees();
this.UIMap.ClickSubmitButton();
User.CloseBrowser(TestContext);
}
catch . . . .
Here is part of my UIMap.Designer.cs:
public void ClickFeesButtonInSecondaryMenu()
{
#region Variable Declarations
HtmlHyperlink uIFeesHyperlink = this.UIInternetExplorerWindow.UIDocument.UIFeesHyperlink;
#endregion
// Click 'Fees' link
Mouse.Click(uIFeesHyperlink, new Point(22, 21));
}
public void ClickAddPaymentButton()
{
#region Variable Declarations
HtmlHyperlink uIAddPaymentHyperlink = this.UIInternetExplorerWindow.UIDocument1.UIAddPaperPaymentHyperlink;
#endregion
// Click 'Add Payment' link
Mouse.Click(uIAddPaymentHyperlink, new Point(84, 15));
}
public void OpenYearDropdownAndSelect2016()
{
#region Variable Declarations
HtmlHyperlink uIItem2017Hyperlink = this.UIFeeInternetExplorerWindow.UIFeeDocument.UIItem2017YearYearPane.UIItem2017Hyperlink;
HtmlDiv uIItem2016Pane = this.UIFeeInternetExplorerWindow.UIFeeDocument.UIItem2016Pane;
#endregion
// Click '2017' link
Mouse.Click(uIItem2017Hyperlink, new Point(149, 20));
// Click '2016' pane
Mouse.Click(uIItem2016Pane, new Point(124, 3));
}
public void Type1234InCheckNumber()
{
#region Variable Declarations
HtmlEdit uICheckNumberEdit = this.UIFeeInternetExplorerWindow.UIFeeDocument1.UICheckNumberEdit;
#endregion
// Type '1234' in 'Check Number' text box
uICheckNumberEdit.Text = this.Type1234InCheckNumberParams.UICheckNumberEditText;
}
. . . and so on until you get to . . .
public void ClickSubmitButton()
{
#region Variable Declarations
HtmlInputButton uISubmitButton = this.UIFeeInternetExplorerWindow.UIFeeDocument1.UISubmitButton;
#endregion
// Click 'Submit' button
Mouse.Click(uISubmitButton, new Point(27, 17));
}
I've only been doing C# MSTEST Coded UI just over a year, but I have three other automators here with tons more experience than I have, and this problem is new to us all. We've looked at everything we can think of, but no joy. Has anyone seen this? What causes this behavior? Most importantly, is there a fix?
Aucun commentaire:
Enregistrer un commentaire