Testing of electrical systems and machines