Malcolm tests Macduff because he's afraid that Macbeth sent Macduff to get Malcolm and trick him to return home. He wants to assure that Macduff is actually truthful in saying that he doesn't like Macbeth. After all, they all were very fond of him before he came king.