Have you seen this npm package?
https://www.npmjs.com/package/serverless-offline
I have no idea if this exists for other languages but its what lets me develop and test my functions locally before deploying them to stage/live.
Edit: they have some good examples - https://github.com/serverless/examples/tree/master/aws-node-...