C# Cookware - presented at CukeUp! 2014

Preview:

Citation preview

C# Cookware

Manuel Pais

CukeUp! London

3rd Apr 2014

Agenda

Prelude

An Ancient World

Forget Physical Laws

Layered World

Parallel Worlds

Prelude

Test .NET Code with Specflow

Test .NET Code with Specflow

Drive a Windows App Using White

Test .NET Code with Specflow

Drive a Windows App Using White

Test Windows GUIs with AutoIt

An Ancient World

Not for everyone

For some many of us

this is more accurate…

Our context

Do desktop applications still make sense?

IF you have to integrate with low-level SDKs

And…

IF client app requires low latency IF you have to integrate with low-level SDKs

And…

AND your stress tests look like this…

Forget Physical Laws

Test automation

with

physical devices ?!

Not great to maintain…

char[] start_scan()

char[] capture()

char[] scan_finger()

Plain Old Interfaces

byte[] start_scan();

byte[] start_scan();

Decoupled Development

x. Device Integration

y. Application Biometric Logic

Decoupled Development

x. Device Integration

y. Application Biometric Logic

Decoupled Development

x. Device Integration

y. Application Biometric Logic

byte[] start_scan();

byte[] start_scan();

byte[] start_scan();

byte[] start_scan();

Requires: Categorized Test Data

Supports: Randomization

Requires: Categorized Test Data

Supports: Randomization

byte[] start_scan();

Virtual Fingerprint Scanner

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

Virtual Fingerprint Scanner

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

Virtual Fingerprint Scanner

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

Virtual Fingerprint Scanner

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

Virtual Fingerprint Scanner

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

Virtual Fingerprint Scanner

Given a traveler leaving the country

When 1 finger is missing

Then emigration supervisor is called

Virtual Fingerprint Scanner

Forget Physical Laws Problem Automate testing of applications using physical devices

Ingredients • Common interface for similar devices

• Virtual device implementation for that interface

• Categorized test data repository

• Test data sampler

Layered World

Reusable core modules

but

Many customizations

and

Specific client requirements ?

Reusable core modules

but

Many customizations

and

Specific client requirements ?

Reusable core modules

but

Many customizations

and

Specific customer requirements ?

Plain Old Layers

Low level UI

automation

across all apps

Low level UI

automation

across all apps

Low level UI

automation

across all apps

Module

“object”

automation

Low level UI

automation

across all apps

Module

“object”

automation

Low level UI

automation

across all apps

Module

“object”

automation

Application

logic

automation

Low level UI

automation

across all apps

Module

“object”

automation

Application

logic

automation

Low level UI

automation

across all apps

Module

“object”

automation

Application

logic

automation

Application Driver DSL

Given a traveler entering the country

When I capture all biometric data

And no alarms are raised

Then travel is allowed

Application Driver DSL

Given a traveler entering the country

When I capture all biometric data

And no alarms are raised

Then travel is allowed

Application Driver DSL

Given a traveler entering the country

When I capture all biometric data

And no alarms are raised

Then travel is allowed

Application Driver DSL

Layered World Problem Automate testing of reusable client modules with project

customizations and specific requirements

Ingredients • Specflow (Cucumber family)

• White (GUI automation)

• Layered test code: pure UI + module + application DSL

Parallel Worlds

Multiple

public-facing interfaces

GUI vs API

Multiple

public-facing interfaces

GUI vs API

OR

Multiple

execution alternatives

GUI objects vs Keyboard shortcuts

Multiple

execution alternatives

GUI objects vs Keyboard shortcuts

Plain old

Dependency Injection

FingerprintsUI

FingerprintsUI

FingerprintsUI FingerprintsShortcuts …

IFingerprints

FingerprintsShortcuts

IFingerprints

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

FingerprintsUI

FingerprintsShortcuts

IFingerprints

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

FingerprintsUI

Fingerprint.IFingerprints

=

Fingerprint.FingerprintsUI

FingerprintsShortcuts

IFingerprints

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

FingerprintsUI

Fingerprint.IFingerprints

=

Fingerprint.FingerprintsUI

FingerprintsShortcuts

IFingerprints

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

FingerprintsUI

Fingerprint.IFingerprints

=

Fingerprint.FingerprintsShortcuts

FingerprintsShortcuts

IFingerprints

Given a complete Visa application

When I capture 4 valid fingerprints

Then application is sent for approval

FingerprintsUI

Fingerprint.IFingerprints

=

Fingerprint.FingerprintsShortcuts

Parallel Worlds Problem Automate testing of multiple interfaces/executions for same

scenario

Ingredients • A single test interface for the exposed functionality

• Two or more implementations of that interface

• (Basic) dependency injection mechanism

Image credits

Ancient world map: http://ancientworldmaps.blogspot.com.es/2010/06/world-map-17th-century_12.html Fingerprint scanners: http://www.bayometric.com/lumidigm-venus-v302.html

http://www.biometricsintegrated.com/passport-seva.html http://www.indiamart.com/bayometric-mumbai/fingerprint-scanners.html

Signature pads: http://www.ez-tech.com.mx/store/STU-500-LCD-Signature-Tablet-Large-STU-500.html http://www.reusetek.com/topaz-t-lbk766se-bhsb-r-4x5-lcd-usb-signature-pad/

http://www.alphacard.com/siglite-signature-capture-terminal Document readers: http://www.access-is.com/ocr640-desktop-full-page-passport-id-reader.php

http://www.access-is.com/ocr601_kiosk_desktop_airport_mrz_passport_reader.php http://www.assuretec.com/product/passport-readers

Cameras: http://www.ephotozine.com/article/canon-eos-1100d-digital-slr-review-16085 http://www.lawyersandsettlements.com/blog/tag/webcam

http://www.hdrphotographypro.org/best-tools/ A4 scanner: http://www.printerland.co.uk/Xerox-7600i-P13571.aspx

Workstation: http://www.channelregister.co.uk/2011/04/12/hp_workstations/ Web technologies: http://www.smartechworldweb.com/smartech_web_technology.html

Building blocks: http://www.getfilecloud.com/blog/2014/01/the-fundamental-building-blocks-of-cloud-computing/#.Uzf2RfmSySo

Unfinished building: http://www.panoramio.com/photo/26507136 UK border control: http://www.theguardian.com/uk/2011/nov/08/border-control-row-targeted-checks

Veridoc: http://www.marpless.co.za/Secure-Document.html Biometric enrolment:

http://www.zimbio.com/pictures/JV59KukDbmF/Home+Office+Minister+Demonstrates+New+Biometric/tA8g2BhKmD9/Phil+Woolas

Border control queue: http://www.dailymail.co.uk/travel/article-2133883/Passport-checks-cut-Olympic-official-complains-hour-delay-Heathrow.html

Recipe template: http://www.vertex42.com/WordTemplates/recipe-card-template.html

Thanks!

Francisco Cerrudo

Francisco Garcia

Javier Perez

José Cruz

Thank you!

Q & A