Generalisation of test code