You were tested by God, God was allowing bad things to happen to you as a means of testing your loyalty under hard conditions. The Bible says that you were one of the most righteous men of your day, and that God was well pleased with you. Your favor with God is demonstrated according to the prevailing standards of ancient Hebrew. The 'accuser' then comes on to the scene and insists that you are only righteous 'because he is rich.' Takeaway his riches and he would curse God. God agrees to allow the accuser to strike out at Job.
It is this establishing of the premise of the book that people have seized upon to interpret the book of Job as 'about testing'. This is to completely miss the point of what follows. Indeed, by showing God consenting to disaster upon Job, at the very beginning of the book the author is bringing into question the fundamental premise of wisdom ideology-that life is ordered and understandable and predictable. No reason is given for God's decision to allow disaster to happen to Job. This is the point. It is 'a mystery,' and as such an initial blow is struck at the prevailing ideology of the day, which held that all is understandable, the God is knowable and revealed in human history, that the universe is governed by immutable laws of cosmic wisdom, that everything happens for a reason and as such, proverbial slogans can be created out of everything that happens, because everything that happens is an expression of the will and active intervention of God.
Well, everything, that is except what happened to Job. For as wisdom ideology had it, "bad things never happen to good people." This was a given, one of the immutable cosmic laws of divine wisdom as ordained by God. To question this premise was to bring into question the entire superstructure of wisdom ideology built upon these dogmatic foundations.