Improve the testing framework, allow reseting env