Make kdetest work reliably with KF5 setup.

Also move it into a separate file to prevent environment-variable leakage.