1.The test is not for Allah it is for you, before you were Man Allah asked all creation if they would like to take on the amanaah which is a test, all of the creation denied it except man and jinn, the reason for this is to give man a choice on what he wants to do, Man chose to have this test.
The test is, do good get good, do bad get bad, Allah did this test for us, so we can chose to go jannah, but we must pay a price to get there, or if we fail then we go hell, Or we could not take the test and be free of responsibility, it was our own choice.
2.Allah does not need to test us, Allah never said he needs to test us, Allah wanted to test us, and we are the ones who asked for it, if we didn't Allah wouldn't have tested us.
3.If Allah forced us not to take the test because he already knew the results, than that would be infringing on our free will to chose what we want, and that would be unfair, it would be the same as stopping someone from enacting his free will and chance to do something because I know he won't actually reach it, if this were the case it would be unfair as Allah is forcing his will on us and not allowing people to chose jannah. So it is a mercy to us
4. Allah knows what will happen, why should Allah stop the test just because he knows what will happen? The hidden assumption here is that Allah is doing the test for himself, which he is not, man must go through the test as they wanted it and they asked for it and must be judged for their own decisions, it is a mercy to mankind
5.You do not understand how qadr works.
You said
, Allah knows the actions He himself would take. Allah knows at the Day of Judgement that the prophet Muhammad would ask for شفاعة. And Allah would accept. Allah cannot refuse the prophet in the Day of judgement. So Allah is not all powerful.
Allah accepts out of his choice, he is not forced to make the choice, he knows he will make the choice, thats it, Allah could have chosen to reject the dua, it is all in his power to do what he wants, Allah can refuse the prophet sallallahu alayhi wasalam, he just chooses not to
Also, the qadr was written by Allah, Allah determined everything, and Allah knew all of it, if he wanted he could have determined it another way, the qadr is under Allahs command, Allah chose for the qadr to be a certain way and he won't change it because he he doesn't want to, u assume qadr is a separate entitiy from Allah which it isnt. Qadr is a direct showing of Allahs Strength and power, it is not a separate thing it is subject to Allah completely.
Where did you get that Allah cannot change his own actions? Allah is the one who chose do to them in the first place