Automate REST API Testing
Transcript of Automate REST API Testing
!
!
W15$Session!6/24/2015! !3:00!PM!!!!!
“Automate$REST$API$Testing”$$
Presented$by:$
Eric$Smith$HomeAdvisor$
$$$$$
Brought$to$you$by:$$$$$
$$
340!Corporate!Way,!Suite!300,!Orange!Park,[email protected]!D!www.sqe.com!
!!!
!!
!!!!! !!!!!
Eric Smith is an agile evangelist software leader with more than fifteen years of experience leading software teams in developing highly complex projects using risk-based, feedback-driven processes. Eric strongly believes that a trust-based, purpose-driven culture produces the best results. He has led software projects and process improvements across organizations in the B2B, Big Data, web, and mobile application spaces. For the past eight years, Eric has been leading software delivery teams for HomeAdvisor, focusing his work on the delivery of new products and mobile application products.
Eric Smith HomeAdvisor
2
• Addressable Domain Resources • Http Verbs acting on the resource
! GET ! POST ! PUT ! DELETE
• Stateless • Semantic Response Codes
REST Representational State Transfer
3
• Express the behavior of the API • Defined Success Cases • Graceful Degradation • Edge Cases • Code Coverage
REST API Testing
4
• Efficiency • Completeness • Open Interface • Expect Failure • Virtualize the API
Why Automate APIs You never know how they are using you
5
• Postman • Jmeter • SOA Test • Cucumber • Rspec - Ruby • Spock - Groovy
Techniques There’s more than one way to skin a cat
13
• Automated all of our REST API’s • Jmeter: tests were run in jmeter manually • Created API’s for a subset of business functions, primarily mobile apps. • Limited resource familiar with running and building the tests.
What were we doing? Independent Automation Team
14
• Architecturally, the team was moving quickly to SOA based development
• Since there was now several teams creating API and the same number of people testing them something had to change.
• Developers were already writing tests to verify their code • Tests weren’t being run automatically as part of the build process
Well what’s wrong with that? Nothing absolutely nothing
15
• Developers are lazy • They don’t want to waste time • They will automate things they have to do more than once • Everyone was doing it differently
Writing Tests to Test the Tests So development started writing automated tests
16
• Developers are lazy • Developers don’t have the knowledge of how to effectively write test
plans • Their intentions were good but the tests they wrote didn’t cover the test
plan • Their tests were not being incorporated into the build deploy process
Well what’s wrong with that? Test plans need to be vetted
17
• API errors from external services should degrade gracefully • We need to be able to simulate unpredictable test cases
! Service Down ! Service Timeout ! Simulated Error
Testing the External API Test plans need to be vetted
18
• Software Developer • Agile Evangelist • Process Iterator • Automated Tester • Software Executive • Father
• @ericrsmith • [email protected]
Who Am I? Who who, who who