Add tests and console mocking feature