A native of Jordan, Sheikh Odeh Muhawesh earned his doctorate at Qum Seminary-Global Institute for Islamic Studies in Iran where he focused on comparative theology and Islamic jurisprudence. As an adjunct professor at the University of St. Thomas, he teaches courses in Islamic theology and the modern history of the Middle East. He also serves on the advisory boards of the College of Arts and Sciences and the Muslim-Christian Dialogue Center at the University of St. Thomas.
The answer to this question is simple, first Allah did not create you to test you, but so that you worship Him..as is clearly stated in the Quran. With that, the test you are refering to is being brought to this present life so that you act, and the results of your actions shall lead you to either Heaven or Hell. This test is not for Allah to know how you will act, but for you to act and come about with your results. Allah does not need to test you to know how will you act...I hope this is clear.
Second, There is a vast difference between knowing something and causing it. Someone who has AIDS-nastajer billah- knows that he is to die, or someone who is sentenced to death at a certain hour, knows that he is to die, does that make those people the doers of dying at those moments? NO, not at all.. The Fact that Allah SWTA knows what is happening to you now and tomorrow, is different than Allah causing you to do good or bad. Allah created the causes of every action, and left it to you to choose what you want. Now it is up to you to take whatever path.. Allah knows what path you will end up taking, but he will give you the choice for taking that path. Allah knows if you are bad, if you are going to repent, that is why there is bada..if you are eating poison as we speak, I know that you will kill yourself, but I know that if you go to the hospital in time, you will be saved..what responsiblity do I have in your actions, aside from knowing them?
I suggest that you read Ayatullah Subhani's book"Albada" in Farsi and Arabic.. Please let me know if you need further explaining. May Allah put the light of clarity in our hearts.