When I was a teacher, I often administered tests to my students. I never gave them a test, however, without first having taught the lesson and then given ample review and study time. The test was not meant to trip them up but to cause them to think through the things they had learned and make them aware of how much they had grown in that knowledge. In other words, their level of mastery of the subject was indicated by the results of the test. It was a way of measuring their progress.
Temptation is a form of test that can be a blessing in disguise.
It causes us to be confronted with a circumstance that requires a choice. How we choose reveals the motivations of our hearts and measures our progress in the kingdom. They had a choice. He provides the way of escape. We are given the choice to succumb or overcome.