(Al-Maeda) 5 : 106
يَا أَيُّهَا الَّذِينَ آمَنُوا شَهَادَةُ بَيْنِكُمْ إِذَا حَضَرَ أَحَدَكُمُ الْمَوْتُ حِينَ الْوَصِيَّةِ اثْنَانِ ذَوَا عَدْلٍ مِنْكُمْ أَوْ آخَرَانِ مِنْ غَيْرِكُمْ إِنْ أَنْتُمْ ضَرَبْتُمْ فِي الْأَرْضِ فَأَصَابَتْكُمْ مُصِيبَةُ الْمَوْتِ ۚ تَحْبِسُونَهُمَا مِنْ بَعْدِ الصَّلَاةِ فَيُقْسِمَانِ بِاللَّهِ إِنِ ارْتَبْتُمْ لَا نَشْتَرِي بِهِ ثَمَنًا وَلَوْ كَانَ ذَا قُرْبَىٰ ۙ وَلَا نَكْتُمُ شَهَادَةَ اللَّهِ إِنَّا إِذًا لَمِنَ الْآثِمِينَ

Oh, you who believed! If the death appears to anyone of you and if you are doing bequest, you make witness with two justice men from among you, or two other than from among you, if you are traveling through the earth and the calamity of death, affects you, and you reckon both of them after prayer, so both of them should swear by Lord Allah if you have any doubt as: "We will not purchase for it a miserable price even if it is for the near kins, and we will not hide the witness of Allah; if we do so indeed we will be among the sinners".

See explanation 2: 180-182, 234, and 5: 8.