"(That He may) test you" means: to put you to the test. "(As to) which of you is best in deed, and He is the Almighty" in His retribution, "the Oft-Forgiving" to whoever believes.