Refactors logic from `serve` task into AppRunner class
Adds unit test for AppRunner