An oath is a formal, often public, promise.
Judges must take an oath to be fair to everyone in court.
Example picture