There are always two aspects to consider about testing: when you think you are ready, and when your sensei thinks you are ready.
Contrary to what I've read in this post, some instructors expect their students to ask them if they are ready to test -- they require the student to ask them directly, well in advance of the test date. They may hint, they may tell you that they expect you to test, but unless you ask, they will not test nor promote you.
Remember, the quality of YOUR test is a reflection of the quality of their instruction. Especially if your test is conducted by a regional Teaching Committee, your sensei may be reluctant to allow you a chance to fail. But, sometimes, an instructor may allow you to test before he thinks you are ready, to give you the experience of failure, and force you to focus on what you need to work on. More often, the testee is so over-prepared that failure is not only not an option, it's not even likely.
And it is possible to fail a test, on your own merits. But it's not the end of the world - it's just a test; You can always test again, after further preparation, and then you will know exactly
what will be expected of you.