TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test...

30
TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well! Malcolm Isaacs (@MalcolmIsaacs) [email protected]

Transcript of TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test...

Page 1: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul 2013 Conference“Future Of Testing: New Techniques and Methodologies”

Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

Malcolm Isaacs (@MalcolmIsaacs)[email protected]

Page 2: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Agenda

Introduction to APIs

What Should we Test?

Challenges of API Testing

Getting Started With API Testing

Practicalities of Writing a Test

Page 3: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

What is this Session About?

JUDGE

ME

by

Mik

e Hov

erDON’T

Malcolm

Isaa

cs

Page 4: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Introduction to APIs

REST (XML)

SOAP

IDOC

JDBC

JMS

HTTP/HTML

HTTP/HTML 5

3rd Party Service Provider

Business Partner

.NET

Composite App Infrastructure

REST (JSON)

 

Consumers

HTTP/XML

Page 5: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

Page 6: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

<note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body> Don't forget me this weekend! </body></note>

Page 7: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

<!DOCTYPE html><html> <body> <a href="http://www.testistanbul.org/"> This is a link </a> </body></html>

Page 8: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

<?xml version="1.0"?><soap:Envelope> <soap:Header> </soap:Header> <soap:Body> <m:GetStockPrice> <m:StockName>HP</m:StockName> </m:GetStockPrice> </soap:Body></soap:Envelope>

Page 9: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

http://www.acme.com/phonebook/UserDetails/12345

Page 10: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

{ "glossary": { “title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "GlossTerm": “SGML", "GlossDef": { "para": "A meta-markup language.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup“ } } } } }

Page 11: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

public class HelloWorld { // method main(): The app’s entry point public static void main (String[] args) { System.out.println ("Hello World!"); }}

Page 12: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Just Some of the APIs…

Page 13: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

What Should We Test?

Unit Tests

Page 14: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

What Should We Test?

REST (XML)

SOAP

IDOC

JDBCJMS

3rd Party Service Provider

Business Partner

.NET

Composite App Infrastructure

REST (JSON)

 

Integration/System Tests

Page 15: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

What Should We Test?

REST (XML)

SOAP

IDOC

JDBCJMS

HTTP/HTML

HTTP/HTML 5

3rd Party Service Provider

Business Partner

.NET

Composite App Infrastructure

REST (JSON)

 

ConsumersFunctional Tests

Page 16: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

What Should We Test?

REST (XML)

SOAP

IDOC

JDBCJMS

HTTP/HTML

HTTP/HTML 5

3rd Party Service Provider

Business Partner

.NET

Composite App Infrastructure

REST (JSON)

 

Consumers

HTTP/XML

Load/Stress Tests

Page 17: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

What Should We Test?

REST (XML)

SOAP

IDOC

JDBCJMS

HTTP/HTML

HTTP/HTML 5

3rd Party Service Provider

Business Partner

.NET

Composite App Infrastructure

REST (JSON)

 

Consumers

HTTP/XMLSecurity Tests

Page 18: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing

Source:http://fitdeck.com/Portals/24254/images/Sunrise.jpg

Page 19: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing – Early Testing

Source:http://fitdeck.com/Portals/24254/images/Sunrise.jpg

Page 20: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing - Collaboration

Source: http://www.hp.com/hpinfo/newsroom/feature_stories/2009/images/09collaboration.jpg

Page 21: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing - Standards

Source: http://www.infoq.com/news/2007/03/innoq-ws-standards-poster

Page 22: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing – Managing Change/Versions

Page 23: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing – Availability

Source: http://www.lego.com/en-US/shared/PageNotFound.aspx

Page 24: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing - Security

Source: http://icdn9.digitaltrends.com/image/security-650x0.jpg

Page 25: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing - Data

Sources: http://upload.wikimedia.org/wikipedia/en/e/e3/Microsoft_Excel_2013_Default_Screen.png,http://en.wikipedia.org/wiki/SOAP_(protocol), http://en.wikipedia.org/wiki/Json

<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header> </soap:Header> <soap:Body> <m:GetStockPrice xmlns:m="http://www.example.org/stock"> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>{ "firstName": "John", "lastName": "Smith", "age": 25,

"address": { "streetAddess": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": 10021 }, "phoneNumbers": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] }

Page 26: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Challenges of API Testing at a Glance

Testing Challenges

Functional Testing

Data Managem

ent

Composite QM

Project

Change ImpactLoad

Testing Implications

End-to-end/ Business Process Testing

Security

Architecture

Governance

Simulating Missing Services

Page 27: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Getting Started with API Testing

Engage Engineer

Find a Tool

Automate Tests

Run Tests

Page 28: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Practicalities of Writing a Test

Import API

Define Flow

Configure Propertie

s

Define Checkp

oints

Run Test

Roll Out

Page 29: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

TestIstanbul Conferences 2013

Summary

Page 30: TestIstanbul 2013 Conference “Future Of Testing: New Techniques and Methodologies” Don’t Test Your Application (Just) by its Cover – Test its APIs as Well!

Thank You!

Malcolm Isaacs (@MalcolmIsaacs)[email protected]