Many people say that, but if you want to pass exams in English, be sure to say "She did so badly...".So do I. You need comparative at there.
or you can say that " She did so bad in the tests that she didn't expect a result like this
but after better in the final exam.
Past perfect uses verb form to place one action before another. In this sentence that is not necessary. You don't need to put "expect" in past perfect because there are plenty of time cues already.I would add: ...than she had expected.... First she had some expectations as to her performance on the tests and then she did the tests.
I am not native speaker though, just guessing...