Android Stub Server
by
Makes Android development more bearable
2
Is API there yet?
3
Common problems with API
Api done in parallel with app
Hard to test cases or production api
Hacking offline (work on airplane, anyone?)
Screenshots without designer :)
4
Partial solutions
Robolectric.addPendingHttpResponse
Apiary � apirary.io �
MockWebServer� github.com/square/okhttp/tree/master/mockwebserver �
Mock Server� mock-server.com �
5
Our Solution
Android Stub Server� github.com/byoutline/AndroidStubServer �
One line in build.gradle
One line in Application
Serve static files from assets+ =
compile ‘com.byoutline.androidstubserver:stubserver:1.1.+’AndroidStubServer.start(context);
config.json define api by request/response pairs
6
Custom requests{ “port”: 8098, “requests”: [ { “method”: “GET”, “path”: “/books”, “response file”: “books.json” }, { “method”: “POST”, “path”: { “base”: “/authentication/login”, “queries”: { “username”: “user”, “password”: “pass1234” } }, “code”: 200, “response”: “OK”, “response headers”: { “Set-Cookie”: “JSESSIONID=ABCDE” } },
{ “method”: “DELETE”, “path”: { “urlPattern”: “/books/[0-9]+”, “queries”: { “otp”: “.*” } }, “code”: 204, “response”: “” } ]}
7
Why this lib?
Starts with app
Dead simple setup 2 lines + config.json
Can be deployed on any device
Works offlineno more “API is down”
Suport for response files and static files
8
To do
Header matching
Assertions?
Better configurationBased on � mock-server.com �
9
Sylwester MadejCEO & Head Developer
Sebastian KacprzakSolutions Architect
[email protected] � byoutline.com �