Which of the following is more grammatically correct?
a. John's performance on the test shocked the teacher.
b. John's performance in the test shocked the teacher.
Performance really depends on the object: You perform IN a play but you perform ON a stage so:
His performance in the play was enjoyable. His performance on the stage was enjoyable.
So really your question comes down to: do you perform on a test? Do you perform in a test? I would lead towards "on" because of other usage:
His grade on the test was 90%. Your third answer on the test was incorrect.
Then again, if we are really talking about an implied "performance in taking" the test, suddenly this could be correct:
John's performance in (taking) the test shocked the teacher.
However I would also go ahead and call both of them "awkward". I would avoid entirely and use
John's performance during the test shocked the teacher.
Or best of all, use K.I.S.S. and avoid the problem altogether:
John's test performance shocked the teacher.
I think if it is a written test, we most often say performance on the test (maybe because we "put our ideas down on paper"), but if it is measuring abilities in an environment, e.g. response times, or skill comparisons (before and after, etc) we use performance in the test.
Methods used in learning to drive and performance in the driving test in Great Britain
The test result, a flame spread index, essentially compares the performance in the test to that of red oak.
The smaller the wear scar, the better the performance in the test. (of motor oil)
As a final step in the test redesign process, USCIS conducted a series of records studies to evaluate applicant performance on the test (us.gov)
...performance on the test of reading comprehension is equal to an age equivalent of 8.7 years and a grade equivalent of 2.6...
Student performance on the test is translated into an overall Scale Score.