Testing Web Apps and APIs (1)
-
Upload
aaron-evans -
Category
Documents
-
view
171 -
download
0
Transcript of Testing Web Apps and APIs (1)
TESTING WEB APPs & APIs
Testing Web Apps and APIsWeb App
StateBehaviorUser Interface
Web API
StatelessHTTP / REST interface
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?
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
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
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
TESTING WEB APPs & APIs
The Front EndHTMLCSSJavaScriptMobile appsSingle page appsDevicesBrowsersFrameworks
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
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.)
TESTING WEB APPs & APIs
Testing web APIsFaster, less error prone
No user interface
Focus on:Functionality of individual serviceIntegration of servicesSmoke test entire system
TESTING WEB APPs & APIs
Deployment testingContainers & VMs
Continuous integration & delivery
Ability to switch from test to production with the flip of a switch (DNS)
TESTING WEB APPs & APIs
DEMOHart - medical information software
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)
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)
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