Refactor test loop into individual test cases