Refactor testtools and add some new test tools.