3

I'm trying to automate a unit test for one of our products. It is ActionScript based but we do not have FlashBuilder. We use Jenkins to do all of our automated output and I can get everything working fine with the file up to and creating and rendering the testMovie of the AS Unit tests FLA file. Doing this will output to the trace output panel the results of the test. I run this flash file using JSFL simlar to

var folderPath = path/to/folder/file.fla
if (fl.fileExists(folderPath))
{
    fl.openDocument(folderPath);
    fl.getDocumentDOM().testMovie;
    fl.getDocumentDOM().close(false);
    fl.outputPanel.save("file:///C:/testJSFL/output.txt");
}

Unfortunately the outputPanel.save runs before the testMovie output is placed as a trace action and I have yet found a way through many Google searches as to how to make the system wait till the movie has run to save this file. I even tried opening and closing the file multiple times. Any help would be appreciated.

kminke
  • 78
  • 10

1 Answers1

1

Make sure testMovie is called as a function and Save the output before closing:

var folderPath = path/to/folder/file.fla
if (fl.fileExists(folderPath))
{
    fl.openDocument(folderPath);
    fl.getDocumentDOM().testMovie();
    fl.outputPanel.save("file:///C:/testJSFL/output.txt");
    fl.getDocumentDOM().close(false);
}
Justin Putney
  • 752
  • 1
  • 5
  • 16
  • Unfortunately the output I'm trying to save is from the execution of the SWF. So even with the way you have this setup it works just the same as mine above and outputs no text to the output.txt file. The problem seems to be there is no way to tell JSFL to wait for the SWF file to finish before saving the output. :( Though I will say that your order of operations are better than what I laid out in the question. – kminke Jan 17 '13 at 19:34
  • 1
    If you need a delay, you can work this into a SWF Panel and use setTimeout in ActionScript to run the JSFL code (via MMExecute). Conversely, you could use LocalConnection in your test SWF to trigger your SWF Panel, which would then call the JSFL. – Justin Putney Jan 17 '13 at 21:32
  • This worked great Justin. Sorry it took me so long to get back to you on this. The delay was exactly what I needed. – kminke Mar 26 '13 at 13:38