I think when GOD created living creatures and their worlds, spiritual and physical, he created all the matrix of spiritual and physical things in a certain proportional way, creating the opposite of every matter in order to diversify His creations.
For example, matter has its antimatter, so the opposite of big will be small, of long will be short, and so on. This means that creating good it has to be the opposite of it the evil. Evil also serve its purpose in GOD’S creation dividing leaving creatures in the same way as a matter divided from antimatter.
GOD does not test people with evil, but allowed evil to test humankind, just like Job was tested. Beside that evil brings only sufferings, on the other hand people tested by evil know exactly what it means, and some fail the test but others succeeded and resisted and opposed the evil with all their strength, in this sense they are the special ones. And, how we possibly can know good without experience the evil?
Knowledge of good and evil is a part of GOD’S nature and His character and personality, He always knew good and evil, as it was recorded in Genesis concerning the tree of knowledge of good and evil. When serpent said to Eve, “You will be like GODS know good and evil” he did not lie, he told the truth.
But the difference between GOD knowing good and evil and humankind is completely different. We use evil for our own advantage over others, but GOD uses our own evil against us. He has no evil, so He uses our own evil to punish us for our evil deeds. Such tactic of GOD shall make us to call for repentance in order to receive forgiveness, and such instances are recorded through entire Bible.
So, from theological point of view, we may say that GOD actually created evil as an opposite to goodness, just like He creates matter and antimatter, plus and minus, and so on.
But from realistic point of view, evil is a part of the over whole knowledge of GOD, and He let this knowledge to be known to all His creations.