Allah, exalted be His praise, says: "And do not pursue that of which you have no knowledge. Indeed, the hearing, the sight and the heart, about all of these there will be questioning." [Surah al-Isra': 36]
And He said: "Except those who testify to the truth while they know." [Surah al-Zukhruf: 86]
And in the story of the brothers of Yusuf (peace be upon him) He said: "And we have testified only to what we know, and we were not guardians of the unseen." [Surah Yusuf: 81]
Imam al-Shafi'i (may Allah have mercy on him) said: "It is not permissible for a witness to testify except to what he knows."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / Q20578
Abd al-Rahman bin Abi Bakrah narrates from his father (Sayyiduna Abu Bakrah, may Allah be pleased with him) that we were with the Messenger of Allah (peace and blessings be upon him), and he (peace and blessings be upon him) said: "Shall I not tell you about the greatest of the major sins? (1) Associating partners with Allah, (2) disobedience to parents." He (peace and blessings be upon him) was reclining; then he sat up straight and said: "(3) False testimony, false testimony, false testimony," or (he said): "false speech." He (peace and blessings be upon him) kept repeating it until we said: If only he (peace and blessings be upon him) would fall silent.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20578
Tawus narrates from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that a man who gives testimony was mentioned in the presence of the Prophet (peace and blessings be upon him), and he (peace and blessings be upon him) said: "As for you, O Ibn Abbas, do not testify to anything except a matter that is as clear to you as this sun," and he (peace and blessings be upon him) pointed with his hand towards the sun.
Al-Humaydi criticised this Muhammad bin Sulayman bin Mismul, and it has not been narrated through any reliable chain; and Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20579
Abu Mijlaz (may Allah have mercy on him) says: I said to Ibn Umar (may Allah be pleased with them both): People call me to bear witness, and I dislike that. He said: Testify to what you know.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20580