end to end testing: bug squashing for api developers

Download End to End Testing: Bug Squashing for API Developers

Post on 14-Apr-2017

461 views

Category:

Technology

0 download

Embed Size (px)

TRANSCRIPT

  • 1

    END TO END TESTING: BUG SQUASHING FOR API DEVELOPERS !

    Ozan Seymen Apigee Principal ArchitectSean Davis Apigee Technical Specialist

  • API Testing - Agenda

    22016 Apigee. All Rights Reserved.

    Popular testing methodologies API testing best practices Popular open source tools

  • Test Driven Development

    3

  • What is Test Driven Development?

    Understand the requirementsWrite tests cases first (and let them fail!)Write code to make tests passRefactor the code often

    42016 Apigee. All Rights Reserved.

  • What is Test Driven Development?

    52016 Apigee. All Rights Reserved.

  • Why use Test Driven Development?

    Iterative development approachEncourages thorough testing, ensuring qualityTests are repeatable and can be automatedConfidence when iterating or refactoring legacy code

    62016 Apigee. All Rights Reserved.

  • Challenges

    Requirements must be well understood by developerFocus on unit testingQA team test effort still highMaintaining set of common test cases

    72016 Apigee. All Rights Reserved.

  • Behavior Driven Development

    8

  • BDD

    92016 Apigee. All Rights Reserved.

    BDD is a software development process with TDD in its heart

  • BDD a software development process

    102016 Apigee. All Rights Reserved.

  • BDD a software development process

    112016 Apigee. All Rights Reserved.

    Business analyst

    developer

    tester

  • BDD a software development process

    122016 Apigee. All Rights Reserved.

    define /document

    automated testsguide /

    provide feedback on progress

    specificationsUse as basisof tests

    3 Amigos

    Developer

    Tester

    Business Analyst

  • BDD Specifications

    Express using examples Describe context, trigger and expected behaviour Prioritize behaviours with business value

    132016 Apigee. All Rights Reserved.

  • BDD Gherkin

    142016 Apigee. All Rights Reserved.

    When you come to document behavior, you need a language Understood by humans and code Gherkin - business readable, domain specific language

  • BDD Given/When/Then

    152016 Apigee. All Rights Reserved.

    Feature: As an Employee I want to buy a coffee so that I wake up in the morning

    Scenario: Buy one coffee Given there is 1 coffee left in the machine And I have deposited 50p When I press the coffee button Then I should be served a coffee

  • BDD Benefits of Gherkin

    162016 Apigee. All Rights Reserved.

    Documentation generation Executable specifications Tooling for editors Reusable snippets shared publicly Tools integration

    Once you have standardized the language

  • 172016 Apigee. All Rights Reserved.

  • BDD Tooling for Automated Testing

    182016 Apigee. All Rights Reserved.

    APICLI

    YADDA

  • BDD Testing with Apickli

    19

    github.com/apickli/apickli

    apickli - REST API testing framework with cucumber.js Open source no relationship to Apigee

    2016 Apigee. All Rights Reserved.

  • Mocking

    20

  • Mocking

    Target API availabilityNetwork, ops, deployment, migrations, patchesParallel development

    Constantly changing/unpredictable data Simulation of certain scenarios for testing When tests rely on previous data populatione.g. forgotten password

    High latency on target

    212016 Apigee. All Rights Reserved.

  • Mocking

    API proxy respond using policies API proxy with node.js amok open source project - https://github.com/api-bucket/amok Import swagger and download server code from

    http://editor.swagger.io/#/ Other tools:Mock ServerWire Mock

    222016 Apigee. All Rights Reserved.

  • API Proxy Testing Environments

    232016 Apigee. All Rights Reserved.

    Environment Apigee Target Data Type of testingDEV/TEST Mock Target Data and behavior from mocks Full IntegrationINTG Actual Backend (DEV) Data and behavior from DEV build of

    target APIsPartial Integration

    PERF Actual Backend (DEV/PERF) Data and behavior from DEV or PERF build of target APIs

    Performance

    UAT Actual Backend (DEV/UAT) Data and behavior from DEV or UAT build of target APIs

    Smoke

    PRE Actual Backend (PROD) Data and behavior from target APIs in production

    Smoke

    PROD Actual Backend (PROD) Data and behavior from target APIs in production

    Smoke

    Smoke testing API bundle deployed properly, access all target endpoints correctly, certificates deployed correctly, configuration is correct

  • Unit Testing

    24

  • API Proxy Testing

    252016 Apigee. All Rights Reserved.

    Do you think it is possible to test an Apigee proxy fully with integration testing?

    No

  • API Proxy Testing Integration test enough?

    262016 Apigee. All Rights Reserved.

    Isolation/Coverage

  • API Proxy Testing Integration test enough?

    272016 Apigee. All Rights Reserved.

    Test Runner Apigee Target Systems

    3rd PartyService Callouts?Async?Complex code?

  • Unit Testing Other benefits

    Code can be tested locally without deployment to Apigee first Much faster than integration testing Can create hooks to enforce testing during commit

    282016 Apigee. All Rights Reserved.

  • Unit Testing Boundary Principal

    292016 Apigee. All Rights Reserved.

    Test within your boundaries dont test libraries you dont control

  • Unit Testing Tooling

    302016 Apigee. All Rights Reserved.

  • Unit Testing

    31

    DEMO TIME!

  • Questions?

    32