Testing is a means goal and not the end goal. Means goals are enablers to achieve the end goals.
God’s end goals can be inferred thru studying the history of the universe and the mankind as a specie.
It’s not hard to see that the universe is a gigantic creation machine where everything God has created in playing a role in the creation process. Thats why God created them and that included humans too. We are also playing a unique and an important role in creation like any other living or non living creation of God we are aware of. As a specie we can succeed in this role only if we succeed in attaining tazkia e nafs at individual level.
Whether humanity is successful in its role as a co-creator or not it wont affect us individually but if we fail to perform our individual role on earth as trustees of the resources of the earth and spend them with justice and excellence in good works we will fail our test and will be held accountable for that.