Refactoring of tests for spm