Reorganize tests code.