testing web apps and apis (1)

16
TESTING WEB APPs & APIs Aaron Evans [email protected] @fijiaaron 1-844-AUTOM87

Upload: aaron-evans

Post on 14-Apr-2017

174 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

Aaron [email protected]@fijiaaron1-844-AUTOM87

Page 2: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

Testing Web Apps and APIsWeb App

StateBehaviorUser Interface

Web API

StatelessHTTP / REST interface

Page 3: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

Modern vs TraditionalWhat are the differences between “modern” web applications and more traditional applications?

What are the challenges we face testing modern web apps?

What can we do to make it easier?

Page 4: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

Modern web applicationsResponsive layout

Various screens sizes and formats (mobile, tablet, desktop)

Reactive user interfaceClient side rendering. DOM manipulation

Web servicesCommunicates via AJAX to RESTful APIs

Cloud infrastructureDeployed as independent containers

Page 5: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

ChallengesUI

Layout, application state, testing independent of services

APINo user interface, versioning, no shared state

Data SourcesRelational databases, noSQL, search, external web services

Cloud infrastructure Provisioning, configuration, intercommunication, security

Page 6: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

SolutionsSeparation of concerns

Test the UI without the back end

Test the back end without the UI

Test deployments without either the front or back end

Environments that can be swapped out or rolled back seamlessly

Page 7: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

The Front EndHTMLCSSJavaScriptMobile appsSingle page appsDevicesBrowsersFrameworks

Page 8: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

UI TestingStill necessary, but not the only (or even primary) way to test

Weaknesses:Slow, brittle, too many interfaces (devices, browsers, etc.)

Useful for:End to end teststesting user experienceverifying requirementsVisual testing

Page 9: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

The Back EndNode.js, Express, Koa, Ruby on Rails, Java, PHP, Go, .NETetc.

RESTMicroservicesRelational & NoSQL data stores (MongoDB, Redis, CouchDB, Elasticsearch, etc.)

External services (payment processing, authorization, etc.)

Page 10: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

Testing web APIsFaster, less error prone

No user interface

Focus on:Functionality of individual serviceIntegration of servicesSmoke test entire system

Page 11: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

Deployment testingContainers & VMs

Continuous integration & delivery

Ability to switch from test to production with the flip of a switch (DNS)

Page 12: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

DEMOHart - medical information software

Page 13: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

DEMO: UI TestingTest as a user through the browser.

Manually, then automate.

Tools:Javascript Mocha (BDD test framework)Selenium (Webdriver.io)Sauce Labs (Cloud devices)

Page 14: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

DEMO: API TestingTest via the REST API

Manually using Postman, then automate

Tools:Javascript Cucumber (BDD test framework)Postman (Google Chrome plugin)Unirest (HTTP library)

Page 15: Testing Web Apps and APIs (1)

TESTING WEB APPs & APIs

ConfidenceUse continuous integration to:

Run tests after every build

Run tests after deployment to every environment

Benefits:Quicker discovery of issuesMore time for manual exploratory testingRelease changes on demand

Roll back production issues immediately

Page 16: Testing Web Apps and APIs (1)

Thanks.

Aaron [email protected]@fijiaaron1-844-AUTOM87