In "Macbeth," why does Malcolm test Macduff?
Unlike his father, who trusted too readily, Malcolm does not trust Macduff. Here, Malcolm shows his political savvy. He knows he is likely to be sacrificed (an innocent lamb to appease an angry god), and is well aware of Macbeth's will to harm him. He thinks Macduff is a potential enemy, for he knows that Macduff once thought highly of Macbeth. He also thinks that Macduff could profit by helping Macbeth and--this is dramatic irony--thinks that Macduff has somehow remained unharmed (we know otherwise, but neither Macduff nor Malcolm know yet).
Unlike his father, Malcolm understands that things can appear fair (beautiful and honest) on the outside yet be foul (evil) within. He wants to know what lies within. The only way for him to be certain is to test Macduff's character. Had Maduff agreed to back Malcolm regardless of how corrupt Malcolm claimed to be, Macduff would have revealed a weakness in his own character and would also have revealed to Malcolm his willingness to support anyone he thought would win. If Macduff would follow a ruler as corrupt as Malcolm claims to be, he would also follow Macbeth.The only way Malcolm could tell for sure that Macduff was on the right side was to test him.
He does not trust Macduff, unlike his father who always trust too easily without checking thoroughly enough into the person's nature before confirming that he is a trustworthy person or not.
Macduff knows that the tyrannical and hungry-for-power Macbeth had murdered his wife and children and wanted to seek personal revenge and vengeance for the loss of his family. As a archetype of the avenging hero, he wants to seek honor by killing the villain of the story
But then , Malcolm thought that if he had trusted Macduff too much, one fine day, he would be betrayed by him and send to Macbeth, as he knows that Macbeth harbor thoughts of harming him in anyway possible. Also, he know that Macduff initially proclaimed Macbeth and praised him highly, so regarding him as a potential obstacle towards success as he might be the "sacrifice" that Macduff was going to give to Macbeth.
He knows that appearance is deceiving and you can't judge people by their cover. They can appear calm and beautiful on the outer side, but in the inner side, evil may be lurking inside and can't be trusted. He wants to know what his Macduff's true character, so he tested him to see if he is in the right side or the bad side. It was like "testing the soup before it is cooked", to see whether the character is good or harboring evil desires, to check whether the character can be relied upon on bigger things.
His testing of Macduff, despite being long-winded and draggy is physiologically accurate. He is trying to coax from Macduff the confession of loyalty and allegiance towards his rule