Add some test helpers.

thanks, fixed and rebased.