Last active
December 23, 2016 05:39
-
-
Save bervukas/df7d25c44be73bdb355c0656f85f604e to your computer and use it in GitHub Desktop.
Sample snippet used in Coded UI Test for an Excel COM add-in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Launch Excel 2016 from '%ProgramFiles%\Microsoft Office\root\Office16\EXCEL.EXE' | |
ApplicationUnderTest excelApp = ApplicationUnderTest.Launch(this.StartAndQuitExcelParams.ExePath, this.StartAndQuitExcelParams.AlternateExePath); | |
// After Excel loads, click the 'Blank workbook' list item | |
Mouse.Click(blankWorkbookListItem, new Point(117, 182)); | |
// Select your add-in's ribbon tab | |
Mouse.Click(myAddinRibbonTab, new Point(276, 771)); | |
// Click a control on your add-in's ribbon, in order to display the VBA userform | |
Mouse.Click(myHelloWorldControl, new Point(305, 72)); | |
// Now that the userform is shown, populate the two textboxes with values | |
myFirstNameTextBox.Text = "John"; | |
myLastNameTextBox.Text = "Doe"; | |
// Press "OK" on the userform, and validate the UI behaves as expected | |
//... | |
// Here the test can succeed or fail, which is exactly what we want! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment