Lorem Ipsum Dolor 
A Example-Driven 
API Tester Allen Lin! 
2014.9.11
Unit Test on API 
❖ JSON format! 
❖ We use to write NSAssert! 
❖ If the struct of JSON output is complex…! 
❖ Takes time to write! 
❖ Hard to check error
Too Many Asserts!!
Better Unit Test by Example 
❖ What if there’s a example…! 
Server API document 
output example 
❖ The document should have example 
diff 
Unit Test
Demo 
simpleAPITester.py
Demo 
simpleDemo.py
Demo 
TestCaseMain.py
Restrict 
❖ Objects struct in an array must be the same! 
❖ Not exactly matching
Summary 
❖ Pros:! 
❖ Do not need to write NSAssert! 
❖ Easy to change example than NSAssert! 
❖ Cons:! 
❖ Do not print on Jenskins
Another Approach? 
❖ Tree Pattern Matching! 
❖ Recursive vs. Pattern Abstract

An Example-Driven API Tester