codedui gut vorbereitet ist halb getestet - … · flash, java no 3rd party-vendor like ranorex...

34
CodedUI – Gut vorbereitet ist halb getestet Nico Orschel, MVP @ AIT, DE Marc Müller, MVP @ 4tecture, CH

Upload: hanguyet

Post on 01-Sep-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

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

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

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

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
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
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

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

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

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

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

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
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

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

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

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

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

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

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

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

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

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

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
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
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

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

<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

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

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

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

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

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

[email protected]

+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

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
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

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