The national test pilot school in california allows civil entrants into its Test Pilot Professional Course. One needs at least 750 hours PIC and a bachelor degree in math, science or engineering and needs to be medically fit.
However the cost of that 51 week course is quite steep with 950.000$ at the moment (prices may change without prior notice).
If you count in the plethora of needed preparation courses that would about double that pricetag.
So you need to get a degree, enough hours and around two million US $ to start thinking about becoming a test pilot. And then you have to compete against experienced military and company or government sponsored pilots.