Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Skale your test environment! Containerized End-2-End-Testing @Herbstcampus Nürnberg

Skale your test environment! Containerized End-2-End-Testing @Herbstcampus Nürnberg

http://www.herbstcampus.de/veranstaltung-5222-containerized-end-2-end-testing.html?id=5222

Bei der Konzeption von End-2-End-Tests ist eines der größten Probleme die Frage, wie die Testausführung möglichst robust, reproduzierbar und skalierbar gestaltet werden kann. Diese Hürde lässt sich mit klassischen Ansätzen nicht überwinden. Einen eleganten Ausweg bieten in Container verpackte Testumgebungen. Dadurch wird es möglich, einen definierten Systemstand reproduzierbar aufzurufen und Tests performant auszuführen.

Es wird zeigt, wie z.B. parallele GUI-Tests in verschiedenen Umgebungen zur Qualitätssicherung beitragen. Die Beispiele sind mit dem Open-Source-Tools Sakuli und Docker realisiert und testen Web- und Rich-Client-Applikationen.

Der Vortrag beinhaltet eine großen Anteil an Live-Demo. Die zugehörige Codebasis wird den Zuhören auch zugänglich gemacht.

Skills
Keine

Lernziele
Ziel ist es, dem Zuhörer aufzuzeigen, wie das Potenzial von Container-Technologien genutzt werden kann, um die Softwarequalität zu erhöhen und den manuellen Testaufwand drastisch zu verringern. Eine abschließende Bewertung der Erfahrungen sowie ein Ausblick auf weitere Einsatzszenarien und Entwicklungsschritte runden den Vortrag ab.

toschneck

August 31, 2016
Tweet

More Decks by toschneck

Other Decks in Programming

Transcript

  1. Characteristics of End­2­End Testing Different types of testing: Regression tests

    Functional approval tests Parallel tests with GUIs are complex Stateful tests: user logins, sessions, history Setup and cleanup of test data Manual effort > effort for test automation
  2. Advantages of Container Technology Isolation of environments Repository for versioning

    and distribution Reproducible application environment Dockerfile, docker­compose.yml Starting containers on­the­fly Optimized for parallel execution Less memory overhead Shared Linux kernel
  3. Containerized GUIs # # # s t a r t

    t h e d o c k e r c o n t a i n e r v i a x ­ f o r w a r d i n g d o c k e r r u n ­ i t ­ e D I S P L A Y = $ D I S P L A Y ­ v / t m p / . X 1 1 ­ u n i x : / t m p / . X 1 1 ­ u n i x : r w r a s c h / i n k s c a p e # # # s t a r t t h e d o c k e r c o n t a i n e r w i t h V N C i n t e r f a c e # c o n n e c t v i a U R L : h t t p : / / l o c a l h o s t : 6 9 1 1 / v n c _ a u t o . h t m l ? p a s s w o r d = v n c p a s s w o r d d o c k e r r u n ­ i t ­ p 5 9 1 1 : 5 9 0 1 ­ p 6 9 1 1 : 6 9 0 1 c o n s o l / u b u n t u ­ x f c e ­ v n c d o c k e r r u n ­ i t ­ p 5 9 1 2 : 5 9 0 1 ­ p 6 9 1 2 : 6 9 0 1 c o n s o l / c e n t o s ­ x f c e ­ v n c
  4. What's provided by ? Category Web tests through HTML selectors

    Testing native UI content (beside of browser content, like PDF's or plugins) Open Source & Java API Headless execution Test writing assistance (recorder, screenshot finder) Automatable / Test result reporting (CI, DB, monitoring environment)
  5. Area: Browser content (e.g. HTML pages, single page apps) Object

    identification by DOM elements Detects when Page/AJAX­Requests are loaded (no waits needed) Can handle with modern web frameworks Recorder functionality Assert functionality Java­API Area: Screen content (e.g. rich clients, browser plugins) Object identification by image patterns (screenshot snippets) Not restricted to a browser, validates and controls what users would see Flexible region patterns for the screen navigation OCR features (experimental) Implemented on top of java.awt.Robot and openCV Java API
  6. Test Case Structure / / t e s t c

    a s e . j s / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * I n i t i a l i z a t i o n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / _ d y n a m i c I n c l u d e ( $ i n c l u d e F o l d e r ) ; v a r t e s t C a s e = n e w T e s t C a s e ( 6 0 , 7 0 ) ; v a r e n v = n e w E n v i r o n m e n t ( ) ; v a r a p p N o t e p a d = n e w A p p l i c a t i o n ( " g e d i t " ) ; v a r r e g i o n = n e w R e g i o n ( ) ; / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * D e s c r i p t i o n o f t h e t e s t c a s e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / t r y { / / . . . / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * E x c e p t i o n h a n d l i n g a n d s h u t d o w n o f t e s t c a s e * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / } c a t c h ( e ) { t e s t C a s e . h a n d l e E x c e p t i o n ( e ) ; } f i n a l l y { t e s t C a s e . s a v e R e s u l t ( ) ; }
  7. Call all Sahi Functions / / t e s t

    a c a s e . j s / * * * * * * * * * * * * * * * * * * * * * * * * * C a l l S a h i F u n c t i o n s * * * * * * * * * * * * * * * * * * * * * * * / _ n a v i g a t e T o ( " h t t p : / / s a h i . e x a m p l e . c o m / _ s _ / d y n / D r i v e r _ i n i t i a l i z e d " ) ; _ h i g h l i g h t ( _ l i n k ( " S S L M a n a g e r " ) ) ; _ i s V i s i b l e ( _ l i n k ( " S S L M a n a g e r " ) ) ; _ h i g h l i g h t ( _ l i n k ( " L o g s " ) ) _ c l i c k ( _ l i n k ( " L o g s " ) ) t e s t C a s e . e n d O f S t e p ( " T e s t S a h i l a n d i n g p a g e " , 5 ) ;
  8. Fluent API for UI Testing / / t e s

    t a c a s e . j s / * * * o p e n c a l c u l a t o r a p p * * * / v a r c a l c u l a t o r A p p = n e w A p p l i c a t i o n ( " g a l c u l a t o r " ) . o p e n ( ) ; t e s t C a s e . e n d O f S t e p ( " O p e n C a l c u l a t o r " , 3 ) ; / * * * c a l c u l a t e 5 2 5 + 1 0 0 * * * / v a r c a l c u l a t o r R e g i o n = c a l c u l a t o r A p p . g e t R e g i o n ( ) ; c a l c u l a t o r R e g i o n . t y p e ( " 5 2 5 " ) . f i n d ( " p l u s . p n g " ) . c l i c k ( ) . t y p e ( " 1 0 0 " ) . f i n d ( " c a l c u l a t e " ) . c l i c k ( ) ; t e s t C a s e . e n d O f S t e p ( " c a l c u l a t e 5 2 5 + 1 0 0 " , 2 0 ) ;
  9. Custom Functions / / e . g . e x

    c l u d e d i n t o a s e p a r a t e c o m m o n . j s / * * * * * * * * * * * C o m b i n e c l i c k a n d h i g h l i g h t * * * * * * * * * / f u n c t i o n c l i c k H i g h l i g h t ( $ s e l e c t o r ) { _ h i g h l i g h t ( $ s e l e c t o r ) ; _ c l i c k ( $ s e l e c t o r ) ; } / * * * * * * * * * * * * * * * * O p e n P D F i n n a t i v e v i e w e r * * * * * * * * * * * * * * / v a r P D F _ E D I T O R _ N A M E = " m a s t e r p d f e d i t o r 3 " ; f u n c t i o n o p e n P d f F i l e ( p d f F i l e L o c a t i o n ) { r e t u r n n e w A p p l i c a t i o n ( P D F _ E D I T O R _ N A M E + ' " ' + p d f F i l e L o c a t i o n + ' " ' ) . o p e n ( ) ; }
  10. Demo ­ Sakuli Container # s t a r t

    t h e d o c k e r c o n t a i n e r d o c k e r r u n ­ i t ­ p 5 9 1 1 : 5 9 0 1 ­ p 6 9 1 1 : 6 9 0 1 c o n s o l / s a k u l i ­ u b u n t u ­ x f c e d o c k e r r u n ­ i t ­ p 5 9 1 2 : 5 9 0 1 ­ p 6 9 1 2 : 6 9 0 1 c o n s o l / s a k u l i ­ c e n t o s ­ x f c e # s t a r t i n p a r a l l e l v i a d o c k e r ­ c o m p o s e # u s e d o c k e r ­ c o m p o s . y m l f r o m h t t p s : / / g i t h u b . c o m / C o n S o l / s a k u l i / t r e e / m a s t e r / d o c k e r d o c k e r ­ c o m p o s e u p
  11. Bakery Demo g i t c l o n e

    h t t p s : / / g i t h u b . c o m / t o s c h n e c k / s a k u l i ­ e x a m p l e ­ b a k e r y ­ t e s t i n g . g i t # s t a r t j e n k i n s j e n k i n s / d e p l o y _ j e n k i n s . s h # s t a r t O M D m o n t i o r i n g o m d ­ n a g i o s / d e p l o y _ o m d . s h # s t a r t t h e b u i l d o f t h e a p p l i c a t i o n i m a g e s b a k e r y ­ a p p / a p p ­ d e p l o y m e n t ­ d o c k e r ­ c o m p o s e / d e p l o y _ a p p . s h # s t a r t t e s t s s a k u l i ­ t e s t s / e x e c u t e _ a l l . s h # s t a r t t e s t s f o r m o n i t o r i n g s a k u l i ­ t e s t s / e x e c u t e _ a l l _ 4 _ m o n i t o r i n g . s h
  12. What's next? Headless execution ­ Linux: VNC & Docker Windows:

    ? Make container OpenShift ready (security, source­2­image) Video recording of the test execution (error documentation) Web UI to handle Sakuli test suites Connect 3rd­party test management tools (HP QC, TestRail, ...) Improve test result presentation in CI tools Selenium as an alternative to Sahi