A witness is a person who comes to court and swears under oath to give truthful evidence. A person who is not available for trial due to death, illness, or absence may be allowed to give testimony through an affidavit, deposition, or other recorded means.
There are rules of evidence governing who is allowed to testify and what they may testify about. Certain persons, such as young children and lunatics are prevented from testifying. There may be a privilege preventing testimony from being given when a confidential communication to an attorney, priest, or spouse is involved. Generally, a person must have first-hand knowledge of the subject matter of the testimony. Rules govern what may be asked of a witness to attack their credibility, such as impermissable attempts to show the witness is generally a "bad person". In some instances, objections to expert testimony can be "cured" by a limiting instruction by the judge for the jury to only consider the testimony for a limited purpose.