KEMBAR78
More Coverage, Better Diagnostics | PPTX
More Coverage, Better Diagnostics

Including API Testing Into the Continuous
   Integration and Deployment Process




      Ole Lensmar, SmartBear Software
Why should you care about API Testing?
Because today, APIs are at the
     core of everything!
Mobile
             Mashups
                              Devices


   Game                                  Web
  Consoles                               Apps



                       APIs
 Cloud
                                        Social Media
Services




                                     B2B
      Appliances
                                   Partners

                   Other APIs
APIs are at the core of business strategies –
       not just technology strategies
APIs are showing extreme growth in all industries




          (from programmableweb.com)
We are in the Golden Age of APIs!
What do we actually mean by “API”?
…
                         WOA
                         SOAP
                         REST
                         JSON
                         WSDL
                          XML
                          JMS
                         Thrift
Buzzwords? Check!        HTTP
                          SOA
                         OAuth
                    Protocol Buffers
                         WADL
                         WS-*
                          POX
                         SPDY
                     WebSockets
                           …
An API is data or a service that is available over
the network using a standard protocol and format

                  for example…


         An HTTP search request returning
              results in JSON format


          A SOAP request for authorizing
           access to a secured system
Common characteristics of APIs

   APIs are consumed by software, not end users

   APIs do not have a UI – there is nothing to “look” at or
    interact with

   APIs expose business logic or functionality, mostly for
    integration purposes

   APIs can be both private or public
How do APIs fit into an architecture?


Business A                                                                 Business B
                                      Mobile /               Web App
                Web App             Desktop App

                                     REST
                                                           SOAP



                                      Public        REST      Public
                                       API                     API
                          REST
        JMS
                                                SOAP              Thrift




      Service             Service              Service        Service
       API 1               API 2                API 3          API
Quality Aspects of an API
   Functionality – does it work as expected?

   Performance – does it perform as required?

   Security – is it secured for common attacks?

   Usability – is it usable?

   Compliance – does it follow common practices?
How do you test an API?
   APIs generally implement a request-response
     model for exchanging messages or data


                Parameterized Request

      Test                              API

                           Response



A simple test sends a request message and validates
that the response message has the expected content
Single vs Multi-Request Tests
           Request

                                  API 1

                       Response


  Multi-     Request
 Request                          API 2
  Test
                       Response


             Request

                                  API 1

                       Response
the “short” demo
How does API Testing relate to
          other types of testing?

      UI Tests
                        Web / Mobile / Desktop
(automated or manual)




      API Tests                 API

                         Unit    Unit    Unit
     Unit Tests
                         Unit    Unit    Unit
Automated API Testing – what do we mean?
“Running preconfigured API Tests
automatically using a test execution
     framework or scheduler”


 Functional – Performance - Security
In Agile you have

      “Continuous Integration”


API Tests should be run automatically and
continuously for every build of the software
In DevOps you have

      “Continuous Deployment”


   API Monitors run continuously to
ensure operations and production quality
Opportunity : Reuse of API Test Assets

                 Development :
       Continuous Integration / Deployment




                  API Tests and
                  Quality Assets




           Operations : API Monitoring
Benefits of Test Asset Reuse

   Realistic monitoring
                             Development


   Feed-forward
    – how it’s supposed to
      work                    Automated
                             Tests / Assets


   Feedback
    – Comprehensive error
      information            Operations
Wrapping up -

How should you treat your APIs?
R-E-S-P-E-C-T your APIs!

      Design for usability

          Test Early

  Create Dedicated API Tests

     Automate your tests

Assert performance and security
Thanks!

      ole.lensmar@smartbear.com

More Coverage, Better Diagnostics

  • 1.
    More Coverage, BetterDiagnostics Including API Testing Into the Continuous Integration and Deployment Process Ole Lensmar, SmartBear Software
  • 2.
    Why should youcare about API Testing?
  • 3.
    Because today, APIsare at the core of everything!
  • 4.
    Mobile Mashups Devices Game Web Consoles Apps APIs Cloud Social Media Services B2B Appliances Partners Other APIs
  • 5.
    APIs are atthe core of business strategies – not just technology strategies
  • 6.
    APIs are showingextreme growth in all industries (from programmableweb.com)
  • 7.
    We are inthe Golden Age of APIs!
  • 8.
    What do weactually mean by “API”?
  • 9.
    WOA SOAP REST JSON WSDL XML JMS Thrift Buzzwords? Check! HTTP SOA OAuth Protocol Buffers WADL WS-* POX SPDY WebSockets …
  • 10.
    An API isdata or a service that is available over the network using a standard protocol and format for example… An HTTP search request returning results in JSON format A SOAP request for authorizing access to a secured system
  • 11.
    Common characteristics ofAPIs  APIs are consumed by software, not end users  APIs do not have a UI – there is nothing to “look” at or interact with  APIs expose business logic or functionality, mostly for integration purposes  APIs can be both private or public
  • 12.
    How do APIsfit into an architecture? Business A Business B Mobile / Web App Web App Desktop App REST SOAP Public REST Public API API REST JMS SOAP Thrift Service Service Service Service API 1 API 2 API 3 API
  • 13.
    Quality Aspects ofan API  Functionality – does it work as expected?  Performance – does it perform as required?  Security – is it secured for common attacks?  Usability – is it usable?  Compliance – does it follow common practices?
  • 14.
    How do youtest an API? APIs generally implement a request-response model for exchanging messages or data Parameterized Request Test API Response A simple test sends a request message and validates that the response message has the expected content
  • 15.
    Single vs Multi-RequestTests Request API 1 Response Multi- Request Request API 2 Test Response Request API 1 Response
  • 16.
  • 17.
    How does APITesting relate to other types of testing? UI Tests Web / Mobile / Desktop (automated or manual) API Tests API Unit Unit Unit Unit Tests Unit Unit Unit
  • 18.
    Automated API Testing– what do we mean?
  • 19.
    “Running preconfigured APITests automatically using a test execution framework or scheduler” Functional – Performance - Security
  • 20.
    In Agile youhave “Continuous Integration” API Tests should be run automatically and continuously for every build of the software
  • 21.
    In DevOps youhave “Continuous Deployment” API Monitors run continuously to ensure operations and production quality
  • 22.
    Opportunity : Reuseof API Test Assets Development : Continuous Integration / Deployment API Tests and Quality Assets Operations : API Monitoring
  • 23.
    Benefits of TestAsset Reuse  Realistic monitoring Development  Feed-forward – how it’s supposed to work Automated Tests / Assets  Feedback – Comprehensive error information Operations
  • 24.
    Wrapping up - Howshould you treat your APIs?
  • 25.
    R-E-S-P-E-C-T your APIs! Design for usability Test Early Create Dedicated API Tests Automate your tests Assert performance and security
  • 26.
    Thanks! ole.lensmar@smartbear.com

Editor's Notes

  • #14 No UI – you can’t see it!