To understand the answer to this question we must understand God's entire plan for us. First you must understand that we existed prior to coming to this earth as the spirit children of God. We lived in his presence and all of us that have come to this earth and received a body were faithful to him. This pre-mortal state is also known as the first estate. This mortal life is known as the second estate. There is an old saying, "When the cats away, the mice will play". We were faithful in our first estate while in the presence of God. But God is raising us to be like him. God is a being who does good in and of himself. Nobody tells God to be good. He does it of his own volition. By his own free will and choice he chooses to be a good person. This requires that he have free will to choose in and of himself. God has given us free will in hopes that we will develop our character into one like his. His hope is that we learn to treasure the good and love doing that which is right and just and true. We were obedient while in his presence with a perfect knowledge of his existence. That was the test of our first estate. Some did not do so well in their first estate and rebelled against God and were cast out with Satan and became one of Satan's angels. They never received a body but are spirit beings only. It was then necessary for God to place us in a situation where we would be tested to see if we would be good or learn to be good over time outside of a perfect knowledge of him and outside his presence. We need to learn to do good in and of ourselves. Only in this way do we truly become more like God.
Sure we make mistakes, but God is loving and patient and gives us second, third, fourth ... chances. He provided a Savior who allows us to repent and be forgiven. He has given us the gift of the Holy Ghost if we covenant by baptism to do his will. He hasn't left us totally in the dark but has made sure that his teachings are in the world for anyone to receive. He blesses those who strive to be good and repent. So when the Cat's away, will the mice do good or will they choose evil? This is the test of this life. Are you a good person in and of yourself or only when you know with a perfect knowledge that God exists and are in his presence? Being a good being is an act of faith and a change of heart to love and follow goodness. The spirit of God comes to those who repent and love to follow him. Like those who were followers of God in the Bible,
1 John 3:2
2 Beloved, now are we the sons of God, and it doth not yet appear what we shall be: but we know that, when he shall appear, we shall be like him; for we shall see him as he is.
John 17:20-23
20 Neither pray I for these alone, but for them also which shall believe on me through their word;
21 That they all may be one; as thou, Father, art in me, and I in thee, that they also may be one in us: that the world may believe that thou hast sent me.
22 And the glory which thou gavest me I have given them; that they may be one, even as we are one:
23 I in them, and thou in me, that they may be made perfect in one; and that the world may know that thou hast sent me, and hast loved them, as thou hast loved me.
Matthew 5:48
48 Be ye therefore perfect, even as your Father which is in heaven is perfect.