God absolutely knows who we are.
"To the choirmaster. A Psalm of David. O LORD, you have searched me and known me! You know when I sit down and when I rise up; you discern my thoughts from afar. You search out my path and my lying down and are acquainted with all my ways. Even before a word is on my tongue, behold, O LORD, you know it altogether." (Psalms 139:1-4)
In one instance, Moses gave an explanation of why God was testing Israel: "Moses said to the people, "Do not fear, for God has come to test you, that the fear of him may be before you, that you may not sin" (Exodus 20:20).
Another time it is said, "...the LORD your God is testing you, to know whether you love the LORD your God with all your heart and with all your soul." (Deuteronomy 13:3)
It almost sounds as if God is trying to "find out the truth" but since we already know God is omniscient, that is obviously not true. Perhaps, at times, He wants US to see what's truly in our hearts.