Automatisiertes Testen mit CodedUI
                   (ohne Frust)

                    Nico Orschel| AIT GmbH & Co. KG




Vorsprung                      AIT GmbH & Co. KG
     durch Individualität
Agenda

       Einführung
       Diagnose von Problemen
       WinForms Anwendungen
       WPF Anwendungen
       Web mit CUITe
       Ausblick: Support für eigene Controls



Vorsprung                     AIT GmbH & Co. KG
       durch Individualität
Visual Studio Testing Landschaft




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Testing features in 2010?

 Generalist                                                                                                  Specialist
 Manual Testing         Some scripting                Strong scripting skills   Strong coding       Expert
                                                                                                    coding skills
                        Creates scripts to set up     Some                      Develops fully
                        lab, create data              coding skills             automated testing
                                                                                procedures




                                                             Other
                                                           Automation
                                                              Tools




                                                    Team Foundation Server                            Reporting




Vorsprung                                                  AIT GmbH & Co. KG                                              4
      durch Individualität
Testing mit der Visual Studio IDE




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Unterstützte Plattformen




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Tracking Technologien


               Technologie                UI Test Ansteuerung
               Windows Forms              Microsoft Active
                                          Accessibility (MSAA)
               Windows Presentation User Interface
               Foundation           Automation (UIA)
               Internet Explorer          MSHTML
               Firefox                    JavaScript und Firefox
                                          DOM
               Silverlight                Code Injection und
                                          Reflection
Vorsprung                          AIT GmbH & Co. KG
     durch Individualität
CodedUI Test mit Visual Studio
  Demo




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
WinForms / Diagnose
  demo…




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
MSAA / UIA Control-Hierarchie




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
MSAA Standard

    MSAA = Microsoft Assessabilty
     Automation
         Standard zur Ansteuerung von
          Anwendungen für Screenreader
    Wichtige Properties
         AccessibleName
         AccessibleDescription



Vorsprung                   AIT GmbH & Co. KG   12
     durch Individualität
Accessibility Problem-Diagnose

    Probleme mit den Standards MSAA und
     UIA ohne Hilfsmittel schwierig zu
     identifizieren
    Diagnose mit folgenden Programmen
     möglich
         Custom Tool*
         UISpy (nur MSAA, Windows SDK)
         AccChecker (UIA und MSAA Best Practice
          Scan)
                Download unter https://acccheck.codeplex.com/

Vorsprung                       AIT GmbH & Co. KG
     durch Individualität
MSAA: AccessibleName und
  AccessibleDescription
  Tip 1




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
ACChecker - dein Freund und Helfer
  (bei MSAA / UIA Problemen)
  Tip 2




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
UIA Standard

    UIA = User Interface Automation
         Nachfolger des Standards MSAA
    UIA Properties
         AutomationId und
         Name
    Definition kann implizit oder explizit
     erfolgen


Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
WPF
  demo…




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
UIA: AutomationName und
  AutomationID zuweisen
  Tip 3




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
Web

    Erweiterung für das CodedUI Framework
         Ursprung: Microsoft Product Group
    Vereinfacht die Entwicklung und
     Wartung von automatischen Tests durch
     Trennung von ObjectRepository und
     Testschritten




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Web
  demo…




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
Wartbarer Testautomation-Code
  mit CUITe
  Tip 4




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
Erweiterungen
  Ausblick




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
UITest Architecture
                                                                                              Write a client that does
                                                                                                 something else!


                  Test Runner                                          Coded UI Test                                  My UI



                                                                                                                      Action
                            Interpreter                                            Code Generation
                                                                                                                     Invoker


                             Customize recording          Add/Modify API                Custom properties & code


                                             Filter/                       API
                                                                                                        Property
                                           Aggregation
                                                                                                        Provider
                      Recorder                Rules                              Playback




                                          Technology Abstraction Layer
                                                                                              Write technology adapters


                Web Plug-ins                        Rich Client Plug-ins
                                                                                                3rd Party Plug-ins
              (MSHTML/DOM)                             (UIA/MSAA)



Vorsprung                                                AIT GmbH & Co. KG
     durch Individualität
4 Phasen Optimierung




                                                               Intent
                                                               Aware
                                                  Code         Actions
                                                  Generation
                                 Rich
                                 Property
                                 Validation
                    Basic
                    Record
                    and Replay
Vorsprung                               AIT GmbH & Co. KG
     durch Individualität
Beispiel WinForms Control




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
Phase 1 - Ziel




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 1 - Basic Record and Playback




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
GetChild Überladung




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 2 - Ziel




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 2 – Rich Properties




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Custom Property Provider




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Property Dictionary




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
GetPropertyDescriptor




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
GetProperyNames




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
GetControlSupportLevel




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Extension Package / Deployment




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 3 - Ziel




         Ziel:




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 3 – Code Generation




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
GetSpecializedClass /
  GetPropertyMamesClassType




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 4 - Istzustand




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 4 - Zielzustand




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 4 - Intent Aware Actions




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
SetPropertyValue




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
GetPropertyForAction




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Extension Package / Deployment




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Phase 4 – Beispiel JQuery




Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
“If you don’t know what you want tested,
  how are you going to automate it?”
  Tip 6




Ihre Software effizienter entwickelt   AIT GmbH & Co. KG
Zusammenfassung ( 1/2 )

   • Konfiguriere Assessabilty Eigenschaften
     von Controls
   • Implementiere Assessabilty Support für
     (eigene) Controls
   • Prüfe Assessabilty Kompatiblität schon
     in frühen Projektphasen
   • Benutze den Codeui Builder für die
     Testautomatisierung

Vorsprung                   AIT GmbH & Co. KG
     durch Individualität
Zusammenfassung ( 2/2 )

   •        Wähle die UIMap Struktur mit Bedacht
   •        Wähle verständliche Methodennamen
   •        Erstelle keine abhängigen Tests
   •        Setze Anwendungen in den
            Ursprungszustand zurück




Vorsprung                     AIT GmbH & Co. KG
       durch Individualität
Stay in Contact


                                Nico.Orschel@aitgmbh.de
                                AIT TeamSystemPro Team
                                AIT GmbH & Co. KG
                                http://www.aitgmbh.de

                                http://www.tfsblog.de

                       http://www.xing.com/profile/Nico_Orschel

                       http://www.linkedin.com/pub/nico-orschel/25/484/602




Vorsprung                                   AIT GmbH & Co. KG
     durch Individualität
Jetzt bewerben unter http://www.AITGmbH.de/Jobs
Freie Positionen:
Application Lifecycle Management mit
Microsoft Visual Studio Team Foundation Server

Berater | Diplomand | Praktikant




Jetzt bewerben unter http://www.AITGmbH.de/Jobs
Links und weiterführende Informationen

       AIT GmbH & Co. KG
             http://www.aitgmbh.de/teamsystempro
       TFSBlog.de
             http://blog.aitgmbh.de/category/tester
       Coded UI Test Extension for 3rd party controls - the basics explained
             http://blogs.msdn.com/b/visualstudioalm/archive/2011/10/28/coded-ui-test-
              extension-for-3rd-party-controls-the-basics-explained.aspx
       Coded UI Test Extension for 3rd party Windows Forms controls–How to?
             http://blogs.msdn.com/b/visualstudioalm/archive/2011/10/28/coded-ui-test-
              extension-for-3rd-party-windows-forms-controls-how-to.aspx
       Useful set of utility functions for Coded UI Test!
             http://blogs.msdn.com/b/gautamg/archive/2010/02/19/useful-set-of-utility-
              functions-for-coded-ui-test.aspx
       TestApi - a library of Test APIs
             http://testapi.codeplex.com/
       UI Accessibility Checker
             http://acccheck.codeplex.com/
       CUITe
             http://cuite.codeplex.com/


Vorsprung                                     AIT GmbH & Co. KG
       durch Individualität

Automatisiertes Testen mit CodedUI (ohne Frust)

  • 1.
    Automatisiertes Testen mitCodedUI (ohne Frust) Nico Orschel| AIT GmbH & Co. KG Vorsprung AIT GmbH & Co. KG durch Individualität
  • 2.
    Agenda  Einführung  Diagnose von Problemen  WinForms Anwendungen  WPF Anwendungen  Web mit CUITe  Ausblick: Support für eigene Controls Vorsprung AIT GmbH & Co. KG durch Individualität
  • 3.
    Visual Studio TestingLandschaft Vorsprung AIT GmbH & Co. KG durch Individualität
  • 4.
    Testing features in2010? Generalist Specialist Manual Testing Some scripting Strong scripting skills Strong coding Expert coding skills Creates scripts to set up Some Develops fully lab, create data coding skills automated testing procedures Other Automation Tools Team Foundation Server Reporting Vorsprung AIT GmbH & Co. KG 4 durch Individualität
  • 5.
    Testing mit derVisual Studio IDE Vorsprung AIT GmbH & Co. KG durch Individualität
  • 6.
    Unterstützte Plattformen Vorsprung AIT GmbH & Co. KG durch Individualität
  • 7.
    Tracking Technologien Technologie UI Test Ansteuerung Windows Forms Microsoft Active Accessibility (MSAA) Windows Presentation User Interface Foundation Automation (UIA) Internet Explorer MSHTML Firefox JavaScript und Firefox DOM Silverlight Code Injection und Reflection Vorsprung AIT GmbH & Co. KG durch Individualität
  • 8.
    CodedUI Test mitVisual Studio Demo Ihre Software effizienter entwickelt AIT GmbH & Co. KG
  • 9.
    WinForms / Diagnose demo… Ihre Software effizienter entwickelt AIT GmbH & Co. KG
  • 10.
    MSAA / UIAControl-Hierarchie Vorsprung AIT GmbH & Co. KG durch Individualität
  • 11.
    MSAA Standard  MSAA = Microsoft Assessabilty Automation  Standard zur Ansteuerung von Anwendungen für Screenreader  Wichtige Properties  AccessibleName  AccessibleDescription Vorsprung AIT GmbH & Co. KG 12 durch Individualität
  • 12.
    Accessibility Problem-Diagnose  Probleme mit den Standards MSAA und UIA ohne Hilfsmittel schwierig zu identifizieren  Diagnose mit folgenden Programmen möglich  Custom Tool*  UISpy (nur MSAA, Windows SDK)  AccChecker (UIA und MSAA Best Practice Scan)  Download unter https://acccheck.codeplex.com/ Vorsprung AIT GmbH & Co. KG durch Individualität
  • 13.
    MSAA: AccessibleName und AccessibleDescription Tip 1 Ihre Software effizienter entwickelt AIT GmbH & Co. KG
  • 14.
    ACChecker - deinFreund und Helfer (bei MSAA / UIA Problemen) Tip 2 Ihre Software effizienter entwickelt AIT GmbH & Co. KG
  • 15.
    UIA Standard  UIA = User Interface Automation  Nachfolger des Standards MSAA  UIA Properties  AutomationId und  Name  Definition kann implizit oder explizit erfolgen Vorsprung AIT GmbH & Co. KG durch Individualität
  • 16.
    WPF demo… IhreSoftware effizienter entwickelt AIT GmbH & Co. KG
  • 17.
    UIA: AutomationName und AutomationID zuweisen Tip 3 Ihre Software effizienter entwickelt AIT GmbH & Co. KG
  • 18.
    Web  Erweiterung für das CodedUI Framework  Ursprung: Microsoft Product Group  Vereinfacht die Entwicklung und Wartung von automatischen Tests durch Trennung von ObjectRepository und Testschritten Vorsprung AIT GmbH & Co. KG durch Individualität
  • 19.
    Web demo… IhreSoftware effizienter entwickelt AIT GmbH & Co. KG
  • 20.
    Wartbarer Testautomation-Code mit CUITe Tip 4 Ihre Software effizienter entwickelt AIT GmbH & Co. KG
  • 21.
    Erweiterungen Ausblick IhreSoftware effizienter entwickelt AIT GmbH & Co. KG
  • 22.
    UITest Architecture Write a client that does something else! Test Runner Coded UI Test My UI Action Interpreter Code Generation Invoker Customize recording Add/Modify API Custom properties & code Filter/ API Property Aggregation Provider Recorder Rules Playback Technology Abstraction Layer Write technology adapters Web Plug-ins Rich Client Plug-ins 3rd Party Plug-ins (MSHTML/DOM) (UIA/MSAA) Vorsprung AIT GmbH & Co. KG durch Individualität
  • 23.
    4 Phasen Optimierung Intent Aware Code Actions Generation Rich Property Validation Basic Record and Replay Vorsprung AIT GmbH & Co. KG durch Individualität
  • 24.
    Beispiel WinForms Control IhreSoftware effizienter entwickelt AIT GmbH & Co. KG
  • 25.
    Phase 1 -Ziel Vorsprung AIT GmbH & Co. KG durch Individualität
  • 26.
    Phase 1 -Basic Record and Playback Vorsprung AIT GmbH & Co. KG durch Individualität
  • 27.
    GetChild Überladung Vorsprung AIT GmbH & Co. KG durch Individualität
  • 28.
    Phase 2 -Ziel Vorsprung AIT GmbH & Co. KG durch Individualität
  • 29.
    Phase 2 –Rich Properties Vorsprung AIT GmbH & Co. KG durch Individualität
  • 30.
    Custom Property Provider Vorsprung AIT GmbH & Co. KG durch Individualität
  • 31.
    Property Dictionary Vorsprung AIT GmbH & Co. KG durch Individualität
  • 32.
    GetPropertyDescriptor Vorsprung AIT GmbH & Co. KG durch Individualität
  • 33.
    GetProperyNames Vorsprung AIT GmbH & Co. KG durch Individualität
  • 34.
    GetControlSupportLevel Vorsprung AIT GmbH & Co. KG durch Individualität
  • 35.
    Extension Package /Deployment Vorsprung AIT GmbH & Co. KG durch Individualität
  • 36.
    Phase 3 -Ziel Ziel: Vorsprung AIT GmbH & Co. KG durch Individualität
  • 37.
    Phase 3 –Code Generation Vorsprung AIT GmbH & Co. KG durch Individualität
  • 38.
    GetSpecializedClass / GetPropertyMamesClassType Vorsprung AIT GmbH & Co. KG durch Individualität
  • 39.
    Phase 4 -Istzustand Vorsprung AIT GmbH & Co. KG durch Individualität
  • 40.
    Phase 4 -Zielzustand Vorsprung AIT GmbH & Co. KG durch Individualität
  • 41.
    Phase 4 -Intent Aware Actions Vorsprung AIT GmbH & Co. KG durch Individualität
  • 42.
    SetPropertyValue Vorsprung AIT GmbH & Co. KG durch Individualität
  • 43.
    GetPropertyForAction Vorsprung AIT GmbH & Co. KG durch Individualität
  • 44.
    Extension Package /Deployment Vorsprung AIT GmbH & Co. KG durch Individualität
  • 45.
    Phase 4 –Beispiel JQuery Vorsprung AIT GmbH & Co. KG durch Individualität
  • 46.
    “If you don’tknow what you want tested, how are you going to automate it?” Tip 6 Ihre Software effizienter entwickelt AIT GmbH & Co. KG
  • 47.
    Zusammenfassung ( 1/2) • Konfiguriere Assessabilty Eigenschaften von Controls • Implementiere Assessabilty Support für (eigene) Controls • Prüfe Assessabilty Kompatiblität schon in frühen Projektphasen • Benutze den Codeui Builder für die Testautomatisierung Vorsprung AIT GmbH & Co. KG durch Individualität
  • 48.
    Zusammenfassung ( 2/2) • Wähle die UIMap Struktur mit Bedacht • Wähle verständliche Methodennamen • Erstelle keine abhängigen Tests • Setze Anwendungen in den Ursprungszustand zurück Vorsprung AIT GmbH & Co. KG durch Individualität
  • 49.
    Stay in Contact Nico.Orschel@aitgmbh.de AIT TeamSystemPro Team AIT GmbH & Co. KG http://www.aitgmbh.de http://www.tfsblog.de http://www.xing.com/profile/Nico_Orschel http://www.linkedin.com/pub/nico-orschel/25/484/602 Vorsprung AIT GmbH & Co. KG durch Individualität
  • 50.
    Jetzt bewerben unterhttp://www.AITGmbH.de/Jobs
  • 51.
    Freie Positionen: Application LifecycleManagement mit Microsoft Visual Studio Team Foundation Server Berater | Diplomand | Praktikant Jetzt bewerben unter http://www.AITGmbH.de/Jobs
  • 52.
    Links und weiterführendeInformationen  AIT GmbH & Co. KG  http://www.aitgmbh.de/teamsystempro  TFSBlog.de  http://blog.aitgmbh.de/category/tester  Coded UI Test Extension for 3rd party controls - the basics explained  http://blogs.msdn.com/b/visualstudioalm/archive/2011/10/28/coded-ui-test- extension-for-3rd-party-controls-the-basics-explained.aspx  Coded UI Test Extension for 3rd party Windows Forms controls–How to?  http://blogs.msdn.com/b/visualstudioalm/archive/2011/10/28/coded-ui-test- extension-for-3rd-party-windows-forms-controls-how-to.aspx  Useful set of utility functions for Coded UI Test!  http://blogs.msdn.com/b/gautamg/archive/2010/02/19/useful-set-of-utility- functions-for-coded-ui-test.aspx  TestApi - a library of Test APIs  http://testapi.codeplex.com/  UI Accessibility Checker  http://acccheck.codeplex.com/  CUITe  http://cuite.codeplex.com/ Vorsprung AIT GmbH & Co. KG durch Individualität