The short answer: Create a survey with all the questions. Let the flash application run the whole test environment. When done, have the flash application upload the result (aka. answers) via the /survey/respond functionality.
Other than that, whatever you do is not reinventing the wheel. You might want to stick with IMS QTI specifications for importing the answer into the survey system and "just" write an import script that takes the IMS QTI compliant answer description from the flash and stores this in the survey_responses table. Talk to Eduardo and Alvaro from E-Lane in Madrid, they might give you some more hints on this.