"And he is witness, whether he has seen or known of it"—Leviticus 5:1.
We are commanded to testify before the judges regarding matters we are aware of, whether we actually saw an event or heard about it. This is true regardless of whether the testimony will cause financial loss for the person regarding whom we testify, or whether the testimony can save a person or his possessions.
One who refrains from giving evidence is guilty of a grave sin.