Is Jesus’ testimony valid or invalid?
John 5:31—”Is Jesus’ testimony about himself valid (8:14) or invalid (5:31)?”
In the first passage (5:31), Jesus is submitting himself hypothetically to the official Jewish law that every matter must be established by the testimony of two or three witnesses (Deuteronomy 19). This is why he goes on to show how both John (whom they respect) and the scriptures testify to his being the Messiah.
In the second passage (8:14), He clarifies that his testimony is valid because of his unique position as God’s Word (John 1:1), Truth (John 14:6), and Messiah.
So in effect, Jesus was saying in chapter five that “officially my self-testimony is invalid according to Jewish law, so here are further witnesses…,” while in chapter eight he steps back to defend the real validity of his unique testimony. There is no contradiction.