Add test coverage

1. Use TinyTest to do App testing
2. Fix bugs founded by adding tests