Split version detection functionality into a BaseTestCase class.

This seems like a useful functionality so make it more easier to re-use this
information.