When Malcolm tests Macduff, he does so in order to make sure that Macduff supports him no matter what. Malcolm lists all the characteristics that would make him a bad king, including lust and greed. He even states he does not want to be king. However, Macduff continues to pledge his loyalty to him.
If this scene were omitted, there are a couple things that we would lose. We would not be able to understand how worried Malcolm is of betrayal, as the killings continue to increase. We would also be unable to understand how loyal Macduff is, and whether he can be trusted against Macbeth.