CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex...
Transcript of CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex...
![Page 1: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/1.jpg)
CodedUI – Gut vorbereitet ist halb getestet
Nico Orschel, MVP @ AIT, DE
Marc Müller, MVP @ 4tecture, CH
![Page 2: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/2.jpg)
Ziele der modernen Software-Entwicklung
Plan Build Release
![Page 3: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/3.jpg)
Microsoft Testmanager (MTM)
•Testmanagement
•Man. Testausführung (Formal+Agile)
•Testumgebungsmanagement
Visual Studio (Testautomatisierung)
•Code
•Autom. Testausführung (DefaultLabTemplate.XAML)*
Release Management (Testumgebungen)
•SCVMM, HyperV, VMware
•Azure, AWS, …
•Cloud Services, …
![Page 4: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/4.jpg)
![Page 5: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/5.jpg)
![Page 6: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/6.jpg)
CodedUI ist eine Testautomatisierungsplattform
CodedUI unterstützt die meisten Windows UI Technologien
Gleiche API für Rich Client und Web Applikationen
6
![Page 7: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/7.jpg)
Ausführung möglich über:
Weitere Informationen http://blog.aitgmbh.de/2010/09/13/codedui-tests-ohne-lab-management-ausfhren/
![Page 8: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/8.jpg)
8
Technology Support Comment
IE 8-11 Yes Older IEs are not supported anymore
WinForms 2.0+, WPF Yes 3rd party controls could be a problem
Windows Store Apps Yes XAML based Store Apps
Chrome, FireFox Yes (> VS 2012 Upd. 4) Latest version via Selenium Adapter
Silverlight No Unofficial support for Silverlight v4/v5 (VS 2010 / 2012 only)
Flash, Java No 3rd Party-Vendor like Ranorex
Windows Win32 / MFC Partially May work with known issues
SharePoint Yes (> VS 2012 Upd. 2) 2007+
Windows 8.1 Store Apps Yes >= VS 2013
Windows Phone 8.1. Apps Yes >= VS 2013 Update 2
Vollständige Liste siehe http://msdn.microsoft.com/en-us/library/vstudio/dd380742.aspx
![Page 9: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/9.jpg)
9
Technology UI Test Implementation Model
Windows Forms Microsoft Active Accessibility (MSAA)
Windows Presentation
Foundation
UI Automation (UIA)
Internet Explorer MSHTML
Firefox (VS 2010) JavaScript and Firefox DOM
Firefox / Chrome (VS 2012+) Selenium
Silverlight Code Injection and reflection
![Page 10: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/10.jpg)
Reco
rdan
dP
layb
ack • Default
Approach
• Poor Code
Generation
• Poor
MaintainabilityR
eco
rdU
I M
ap
s • Better
Maintainability
• Supports large
test
repositories
Han
d C
od
e T
est
s • Expert Mode
• Cleanest
Automation
Model
10
![Page 11: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/11.jpg)
![Page 12: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/12.jpg)
u
vw
x
y
● Klick
![Page 13: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/13.jpg)
Source
Code (Test)
Test
Assembly
Test
Result
(HTML)
Logs
IntelliTrace
UIMap(s)
(XML+CS)
…
verwendet Ausführung
(MSTest)
![Page 14: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/14.jpg)
Aufnahme starten/ pausieren
Aufgenommene Schritte anzeigen
Aussagen hinzufügen
Code generieren
![Page 15: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/15.jpg)
15
![Page 16: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/16.jpg)
Anwendung der SE Prinzipien
Einfache Lesbarkeit der Szenarios
Test ist fokussiert auf Interaktion, kein «Plumbing»
16
![Page 17: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/17.jpg)
Code First Vorteile:
Code First Nachteile:
17
![Page 18: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/18.jpg)
Test Code mit MSTest
WpfControl XamlControl HTMLControl WinControl
Basisklasse UITestControl
Technology Manager
UIA Web MSAA
Keyboard
Mouse
Gesture
![Page 19: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/19.jpg)
CodedUI abstrahiert die darunterliegende UI Technologie
Technologieabhängige Implementierung:
Sind CLR-Objekte
Lassen sich über Properties / Methoden ändern
![Page 20: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/20.jpg)
20
![Page 21: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/21.jpg)
21
public virtual WpfControl FindControlById(WpfControl parentControl, string id)
{
WpfControl control = new WpfControl(parentControl);
control.SearchProperties[WpfControl.PropertyNames.AutomationId] = id;
return control;
}
...
public void ClickManageEventsButton()
{
WpfControl button = this.FindControlById(this.MyEventsMainWindow,
"ManageEventsButton");
Point clickPoint = new Point();
button.TryGetClickablePoint(out clickPoint);
Mouse.Click(button, clickPoint);
}
![Page 22: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/22.jpg)
![Page 23: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/23.jpg)
![Page 24: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/24.jpg)
UIA ist fester Bestandteil von WPF
Wichtige Eigenschaften
![Page 25: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/25.jpg)
<ButtonAutomationProperties.AutomationId=„InsertCardButton"AutomationProperties.Name=„InsertCardButton" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1"Margin="5"Command="{Binding Path=InsertCardCommand}">
Insert Credit Card</Button>
![Page 26: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/26.jpg)
User Interface Automation
26
![Page 27: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/27.jpg)
Ansteuerung von WinForms Controls erfolgt per MSAA
Wichtige Properties
![Page 28: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/28.jpg)
Microsoft Active Accessibility
28
![Page 29: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/29.jpg)
Ansteuerung von Webanwendungen erfolgt per IE DOM bzw. Selenium Adapter (VS 2012 Update 2)
Wichtige Eigenschaften für HTML Tags
![Page 30: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/30.jpg)
Access Document Object Model (DOM) in Browser
30
![Page 31: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/31.jpg)
+49 151 55052624
AIT GmbH & Co. KGLeitzstr. 45, 70469 Stuttgart
www.aitgmbh.de
BERATUNGAgile ALM und TFS
.NET und Architektur
ENTWICKLUNGDienstleister für individuelle
Lösungen mit .NET und Azure
© AIT GmbH & Co. KG – Alle genannten und gezeigten Marken oder Warenzeichen sind eingetragene Marken oder eingetragene Warenzeichen ihrer jeweiligen Eigentümer und ggf. nicht gesondert gekennzeichnet. Aus dem Fehlen der
Kennzeichnung kann nicht geschlossen werden, daß es sich bei einem Begriff oder einem Bild nicht um eine eingetragene Marke oder ein eingetragenes Warenzeichen handelt.
![Page 32: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/32.jpg)
Marc Müller
Principal Consultant
für DevOps, ALM, TFS /VS, .NET
E-Mail: [email protected]
Webseite: http://www.4tecture.ch
Schulungen: http://4tecture.ch/trainings
Blog: http://4tecture.ch/blog
Twitter: @muellermarc
![Page 33: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/33.jpg)
![Page 34: CodedUI Gut vorbereitet ist halb getestet - … · Flash, Java No 3rd Party-Vendor like Ranorex Windows Win32 / MFC Partially May work with known issues ... Windows Presentation Foundation](https://reader031.fdocuments.us/reader031/viewer/2022031006/5b8a9e187f8b9a49258b7721/html5/thumbnails/34.jpg)
MSPress Engineering For Accessibility http://download.microsoft.com/download/5/0/1/501FF941-E93D-423F-868B-C7BB2EC08C56/engineering_for_accessibility_eBook.pdf
Beispiel Codehttps://github.com/marc-mueller/Demo-CodedUI