APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’...
Transcript of APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’...
![Page 1: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/1.jpg)
T15 Test Automation 2019-‐05-‐02 13:30
API Testing: Going from Manual to Automated
Presented by:
Patrick Poulin API Fortress
‘
Brought to you by:
888-‐-‐-‐268-‐-‐-‐8770 ·∙·∙ 904-‐-‐-‐278-‐-‐-‐0524 -‐ [email protected] -‐ http://www.stareast.techwell.com/
![Page 2: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/2.jpg)
Patrick Poulin Patrick Poulin has been working in NYC tech for 12 years. His career started as a project manager, but soon he was managing the retail vertical for a company building the first mobile websites for over 75 major brands such as Tesco, Target, Macys, and MAC Cosmetics. After a (thankfully) short stint in adtech, he became the API Evangelist for Getty Images. This is where he first recognized the lack of good API tools. That experience is what led to the creation of API Fortress with his cofounder.
![Page 3: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/3.jpg)
API Testing as an Afterthought
Jason Ioannides, Sales Engineer
Watching the World Burn:
With
![Page 4: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/4.jpg)
Richard Feynman 1918-1988 Theoretical Physicist
Why Are We Asking the Questions We Ask With Testing?
![Page 5: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/5.jpg)
“Does the software work?”
How are we asking this question and more importantly, why?
How Does Feynman Apply?
![Page 6: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/6.jpg)
Unit Testingdef calculate_final_price(price, discount): if discount=='30%': return price-(price*0.3) if discount=='50%': return price/2 return price
Our example (a real snippet!):
![Page 7: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/7.jpg)
Manual Front End TestingVisual Regression Testing
“Click” Testing
![Page 8: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/8.jpg)
Request: POST /cart/add{ "productId": 511, "name": "Smarty pants", "quantity": 1, "price": 5.99, "discount": "30%"}
Response:{ "transaction": "ok", "subtotal": 4.193}
•
Request: POST /cart/add{ "productId": 511, "name": "Smarty pants", "quantity": 1, "price": 1.99, "discount": "50%"}
Response:{ "transaction": "ok", "subtotal": 0.995}
API Testing
![Page 9: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/9.jpg)
Cardinal Rule #1
We are not simply testing communication.
APIs are complex beasts and can expose a huge volume of internal functionality.
![Page 10: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/10.jpg)
Cardinal Rule #2
We have to treat API testing as the special sort of situation that it is.
Testing internal functionality of software while the whole system is operating.
“Taking the pulse” of the software.
![Page 11: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/11.jpg)
Rule 1:Keep itDRY
DRY:Don’t Repeat Yourself
• Parameterize data and code wherever you can
• Increase the modularity of the work you’re doing
• Create reusable tests
![Page 12: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/12.jpg)
Rule 2:Make Your Intentions Clear
• How am I going to remember what this test is for?
• How is the next developer or tester going to know what this test is for?
• We need to do increasing amounts of work if our tests can’t be reused
• Collaboration is very difficult when the intent behind a test is obscured
![Page 13: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/13.jpg)
Rule 3:Act Likethe ConsumerWould!
• Stop creating test cases in a vacuum
• Many APIs exist in the scope of a system
• Testing individual parts is important, but testing full workflows is more important
• Simulate user workflows to find the holes
![Page 14: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/14.jpg)
Rule 4:EliminateStatic DataSources!
• Static data is rarely your friend
• Caveat: Some endpoints rely on static data. That’s okay!
• Use live data wherever possible
• Where live data is unavailable, use mock responses that match your expected response
![Page 15: APIFortress Axway Presentation 0301 - StickyMinds...T15! TestAutomation’ 201910510213:30’ ’ ’ ’ ’ ’ ’ API!Testing:!Goingfrom!Manual!to! Automated!! Presentedby:’’](https://reader034.fdocuments.in/reader034/viewer/2022050408/5f851908d48b1802f96aa793/html5/thumbnails/15.jpg)
www.apifortress.com/axwayLEARN MORE AT: