There has been a lot of media discussion about being a witness at a trial and how difficult that is. Certainly being a witness can be scary and it's easy to doubt yourself; I know this from having been a witness several times over the years. All that said, there are certain things you can do to make it easier.
The first thing to remember is that as a witness you are not expected to have a perfect recollection of everything – all you can do is tell your story as best you remember it. Being a witness is not a memory test - it's an attempt to figure out what happened some time in the past. So long as you tell the truth about what you remember today you cannot go far wrong.
That does not mean you should not prepare yourself. Maybe you gave a statement some time to the police or maybe you wrote some letters or emails that described what happened. Take the time to reread those papers. Perhaps they will refresh your memory – but the important thing is to say what you remember happened. If your current memory is different from what you wrote or said in the past you should say what you remember now – but appreciate you are going to be asked why your current recollection differs from what you said before. The best answer is to say "I know what [for example] I wrote in my letter is different than what I said today but I am telling you what I remember".
That takes us to being cross examined - that's when your testimony may be challenged by one of the lawyers at court. You don't need to worry about being yelled at – the judge won't allow it and good lawyers never even try. But you may well be challenged and asked difficult questions. Listen carefully and answer truthfully. If you made a mistake admit it. Everyone gets confused. If you are wrong don't argue – agree and move on. If you don't remember then say so. Forgetting is normal and accepted.
All that said don't doubt yourself too much. If you remember something say you remember it. If you remember seeing a blue snow machine going really fast then say "I saw a blue snow machine going really fast". Don't start worrying if it might have been greenish blue or blue with pink stripes – say what you remember and don't overthink it.
Finally, be serious in court. Dress respectfully – you don't have to wear a suit of you don't have one but wear clean neat clothes. Call the judge Your Honour. Listen closely to the questions and if you don't understand ask for clarification. No one is there to insult you or demean you – what the court wants is what you remember.
If you tell the truth as you remember it you will not go far wrong.