sort tests. first errors sorted with first required