The best interest of the child includes what the court can learn from all available resources — including the child’s wishes (considered when the child is old enough and it is appropriate). Courts use a child representative or a Guardian ad Litem (GAL) to investigate and represent the child’s interests, which is often how a child’s voice reaches the judge.
The child is not usually “testifying” in court the way a party does — the child representative or GAL gathers that input far more safely and without putting your child in the middle.