You are on page 1of 21

API Testing and

Automation tools
Edwin Taquichiri Montao

Agenda
API Testing
API Test Cases
Approach of API Testing
API Testing Challenges
Automation Tools
Best Practices of API Testing

Automation Tools

2013 TechZone. All rights reserved.

What is API Testing?


An API (Application Programming Interface) is a collection

of software functions and procedures, called API calls, that


can be executed by other software applications.
API testing is mostly used for the system which has

collection of API that needs to be tested. The system could


be: system software, application software or libraries.

2013 TechZone. All rights reserved.

Test Cases for API Testing


The test cases on API Testing are based on the output
Returned value based on input condition
Does not return anything
Trigger some other API/event/interrupt
Update data structure
Modify certain resources

2013 TechZone. All rights reserved.

Approach of API Testing


Understanding the functionality of the API program and clearly

define the scope of the program


Apply testing techniques such as equivalence classes, boundary

value analysis and error guessing and write test cases for the API
Input Parameters for the API need to be planned and defined

appropriately.
Execute the test cases and compare expected and actual results.

2013 TechZone. All rights reserved.

API Testing Challenges


GUI is not available
Parameter selection
Validate and verify the output
Call sequencing
Proper exception handling

2013 TechZone. All rights reserved.

Unit and API Testing


Unit Testing

API Testing

Performed by developers

Performed by testers

Separate functionality is tested

End to End functionality has been tested

Developer can access the source code

Testers usually cannot access the code

UI testing is also involved

Only API functions are tested

Only Basic functionalities are tested

All functional issues are tested

2013 TechZone. All rights reserved.

Best Practices of API Testing


Planning the test cases. What and How to test the API functions
Organize the test properly so that those API can be organized

properly
Parameters selection should be explicitly mentioned in the test

case itself
Call sequencing should be performed and well planned
Prioritize API function calls so that it will be easy for testers to

test

2013 TechZone. All rights reserved.

Automation Tools
SOAP
SOAPUI (java) www.soapui.org
php SOAP extension (php) http://php.net/manual/es/book.soap.php

REST
SOAPUI
curl
chrome extensions (Advanced REST client, postman)

2013 TechZone. All rights reserved.

SOAPUI

10

2013 TechZone. All rights reserved.

SOAPUI (Request and Response)

11

2013 TechZone. All rights reserved.

SOAPUI (Test Cases)

12

2013 TechZone. All rights reserved.

SOAPUI (Suite)

13

2013 TechZone. All rights reserved.

CURL
A command line tool for getting or sending files using URL syntax.

14

2013 TechZone. All rights reserved.

CURL - Example
http://developer.espn.com/docs/athletes#parameters
curl -k

"http://api.espn.com/v1/sports/basketball/nba/teams/24?api
key=zzzuy4exm2tmvgnb5j3df4xz" | python -mjson.tool

15

2013 TechZone. All rights reserved.

CURL - Example

16

2013 TechZone. All rights reserved.

Chrome Extensions

17

2013 TechZone. All rights reserved.

Chrome Extensions

18

2013 TechZone. All rights reserved.

Public APIs
http://www.programmableweb.com/apis/directory

19

2013 TechZone. All rights reserved.

Q&A
20

2013 TechZone. All rights reserved.

21

2013 TechZone. All rights reserved.