It's called the Deposition.
It's an oral testimony of a witness that is reduced to a writing for the later use in court. During Deposition, the witness is recorded by a stenographer while being questioned by Lawyers. During this Process, the Witness is under oath .