$30 off During Our Annual Pro Sale. View Details »

Because every QA should know API Testing

Because every QA should know API Testing

Frederico Moreira

May 07, 2019
Tweet

More Decks by Frederico Moreira

Other Decks in Technology

Transcript

  1. Because every QA
    should know API
    Testing
    Frederico Moreira / Ramilo Neves

    View Slide

  2. Brazil (Minas Gerais)
    ● Café, testes e pão de queijo
    ● MTC - Minas Testing Conference
    Agile Testers
    ● Fórum
    ● Agile Testers Conference
    UAI, TREM, SÔ, PÃO DE QUEIJO
    ● if(cachaça || bagaço)
    @fredaomoreira
    @farfetch

    View Slide

  3. @ramilomcneves
    @farfetch
    Brazil (Petrópolis - Rio de Janeiro)
    ● Tester Automation Engineer
    ● In love with football
    –Flamengo (Brazil)
    –Porto (Portugal)
    ● Living two years in Porto
    ● Second time speaking at PTM

    View Slide

  4. API
    ● Who is here doing an
    API test today?
    ● Who has tested the API?
    ● Who automates API
    testing?

    View Slide

  5. What is an API?
    “An API is created when a software
    company intends that other software
    developers develop products associated
    with its service.”

    View Slide

  6. Examples
    ● Google
    ○ Google Maps
    ○ Google Flights
    ● Accommodation
    ○ Trivago
    ○ Airbnb
    ● Payment providers
    ○ Paypal
    ○ Klarna

    View Slide

  7. Testing data

    View Slide

  8. Service Level Tests
    Subcutaneous Test -
    Martin Fowler
    Fills gap between
    unit and UI tests
    They occur in
    parallel to the
    development
    Focus on
    functionality rather
    than behavior /
    experience

    View Slide

  9. Anti Patterns

    View Slide

  10. Anti Patterns

    View Slide

  11. The most common to find in
    the market are new designs
    using Rest, over HTTP
    protocol.
    But you can use Rest with
    other protocols like TCP,
    UDP and gRPC
    (http:/
    /www.grpc.io/).

    View Slide

  12. View Slide

  13. View Slide

  14. What we validate in a
    api test?
    ➔ http status code
    200, 201, 400, 401, 500 ...
    ➔ body content
    Json, Plain text, XML ...
    ➔ http headers
    "Content-Type"":"application/json"

    View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. View Slide

  19. View Slide

  20. View Slide

  21. View Slide

  22. View Slide

  23. http:/
    /racksburg.com/choosing-an-http-status-code/

    View Slide

  24. Understanding
    HTTP transactions

    View Slide

  25. request
    response
    VIEW

    View Slide

  26. View Slide

  27. Manual Test Tools:

    View Slide

  28. But I really need to
    automate API tests?

    View Slide

  29. Automated Testing Frameworks:

    View Slide

  30. http:/
    /www.mocky.io/

    View Slide

  31. https:/
    /github.com/fredmoreira/register-employees

    View Slide

  32. API Test Project
    DB
    INTERNAL TECH WORKSHOPS
    Environment

    View Slide

  33. API Test Project
    DB
    HTTP

    View Slide

  34. Show me the code...

    View Slide

  35. Repositórios:
    https:/
    /github.com/fredmoreira/register-employees-pyresttest
    https:/
    /github.com/fredmoreira/register-employee-rest-assured-test
    https:/
    /github.com/fredmoreira/register-employees-super-test
    https:/
    /github.com/RamiloNeves18/register-employees-httparty
    https:/
    /github.com/fredmoreira/phone-book
    https:/
    /github.com/RamiloNeves18/register-employees-restsharp
    https:/
    /github.com/fredmoreira/register-employees

    View Slide

  36. Questions?

    View Slide