"And We certainly tested those before them, so that Allah would surely know those who were truthful" in what they displayed of faith, "and He would surely know the liars," meaning: those who display faith while their hearts are upon disbelief, and they are the hypocrites. This is the knowledge of deeds.
Muhammad said: The meaning of "knowledge of deeds" is the knowledge by which the evidence is established and upon which recompense is based, as Allah has known the truthful one and the liar before creating them.