This is true, but it's become a partisan issue, at least in the U.S, to talk about testing teachers in some way.
I believe a huge problem is finding a way to differentiate a good teacher from a bad teacher if you're not allowed to look at grades/some kind of standardized test. If you can take those into account, as long as a teacher comes into work on time I'm not sure how you could differentiate the good from bad.
An example I like to use is my AP Calc teacher from highschool, who had an average score of 4.7 for her students on the AP test. The average in 2012 was a 2.9 (the year I took it, it seems to be higher now, I can't say to as if they made it easier or if people got better though) [1]. In many school systems though, if your teacher has an average score below the national average, you can't do anything about it.
[1] https://www.totalregistration.net/AP-Exam-Registration-Servi...
I'm not saying everyone can teach equally. I'm saying most everyone can become qualified to teach. Please don't accuse me of saying teaching is easy. At the very least, a much larger subset can learn to teach than can learn to code.