I want to get out of this test of duniya. I don't want to face anything in hereafter. There must be a way not to give the test and get rid of Allah. What is it?
You can't, because verily Allah SWT tested every soul, as is it in the Qur'an chapter 29 verse 2 to 3
(29:2) Do people think that they will be let go merely by saying: “We believe,” and that they will not be tested,1 (29:3) for We indeed tested those who went before them?2 Allah will most certainly ascertain3 those who spoke the truth and those who lied.
We agreed to the Test
Allah asked humans if they want to give this test. We agreed to that
Surat Al-Ahzab [verse 72]
Indeed, we offered the Trust to the heavens and the earth and the mountains, and they declined to bear it and feared it; but man [undertook to] bear it. Indeed, he was unjust and ignorant
So now we are in the test. There is no going back. And everything is this earth is test for us.
If I presume that you are asking this because of hardships then you should know that every person has to face hardships in their life. Everyone of us will go through difficulty according to our capacity and Allah will not punish us for what is beyond our capabilities.
Allah does not burden a soul beyond that it can bear
The Messenger of Allah, peace and blessings be upon him, said, “Follow the right course, seek nearness to Allah, and give glad tidings. Verily, none of you will enter Paradise by his deeds alone.” They said, “Not even you, O Messenger of Allah?” The Prophet said, “Not even me, unless Allah grants me his mercy. Know that the most beloved deed to Allah is that which is done regularly, even if it is small.”
Source: Ṣaḥīḥ al-Bukhārī 6099, Ṣaḥīḥ Muslim 2818
We just need to keep trying in our best of capabilities