Antigone's advice is the most important advice, however below are some tips to being a good character witness. The attorney for the person for whom you are witness will probably advise you on most of these, prior to your appearance in court.
1. Dress appropriately. Present a positive appearance. Do not look flashy or
trashy. Do not chew gum, eat candy, and do not smell like tobacco or
strong perfume or cologne.
2. Don't exaggerate. It is better to present personal examples from
your personal experiences with the person than to make blanket
statements. Let the examples you provide speak for themselves.
Do not draw your own potentially false conclusions. Example: Instead of
saying "He would never abuse children" (which you cannot
know for a fact) say "He entertained children with his magic tricks at
a school fundraiser" and "He hugs his child often." Let others draw
conclusions from the facts of your positive experiences.
If you will be questioned:
3. Listen to all questions completely and pause before answering. You
cannot take back what you say, so be careful with your words. Do not
volunteer information. If a question requires a yes or no answer, say
yes or no only.
4. Keep your answers consistent.
5. If you don't know an answer, or can't remember, say that. Don't guess.
6. Don't let an attorney lead you to answer a question if you do not agree
with the answer.
7. If you misspeak, correct yourself as soon as possible.
And, finally:
8. Be respectful of everyone in court. Do not argue, interrupt, or mumble.
Don't talk just to talk.
9. If you know of anything negative about the person for whom you
are giving a character reference, let the attorney know. No surprises. If
there could be anything damaging in what you say, the attorney needs
to be prepared to handle it.
10. And, again as Antigone said, tell the truth. That is the most important
piece of advice.
Good luck.