First of all, you need to start testing for Courage when your army is Broken (i.e. you have lost 50% or more of your starting numbers). These Courage tests are done before a model wants to move (but also if a model does not want to move). So, a model normally tests for Courage, runs away or stays and then does his movement. Then play continues to the next model, etc etc.
Now, this is were Heroes come in. If one of your Warriors has a friendly Hero who has this turn already passed his Courage test within 6" at the start of the Warrior's move, he does not need to test for Courage: he then counts as already having passed the test!
For this it is useful to move your Heroes (and let them pass their Courage tests) first. If you do not move the Hero first, he will not give a Stand Fast! so the Warrior will have to test normally.
Do you understand?