Glucose test

Is this test optional? And what week do you have to take it ?