Forum Discussion

tengel's avatar
tengel
Contributor
13 years ago

Is there a way to speed up saving a file? (Function attached as copied from script file)


function 

FuncSaveFile(scriptName)



{



try



{



Log.Message("MiscFunctions.MiscFuncSaveFile() reached","",300,attrPathA);



// assemble the directory name in which to save the script files



var scriptDirectory =resultsStorageMasterDirectory+"\\"+projectSuiteName+"\\"+projectName+"\\" + scriptName;



var date_time =aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%y_%m_%d__%H_%M_%S");



var FileName = scriptDirectory +"\\" + date_time +".mht";



Log["SaveResultsAs"](FileName, 2);



Log.Message("File Name= "+FileName);



Log.Message("MiscFunctions.MiscFuncSaveFile() exiting","",300,attrPathA);



return FileName;



}



catch (exception)



{



Log.Message("Exception in MiscFunctions.MiscFuncSaveFile(): " +exception.description,"",300,attrError);



}



}


  • It can be very time consuming to wait for a file to finish saving its results. Is there a better way to do this?

  • Hi Tom,


     


    If it takes much time to save the TestComplete log, maybe you need to consider dicreasing its size. For example, you can use the LockEvents method to stop posting events.


    Also, you can try saving the log asynchronously. Read the "CallObjectMethodAsync Method" article for details.

  • I finally got around to working on this.  I looked at the writeup on the method you suggested and I am puzzled.  It says


    "It is not recommended to use this method to perform asynchronous calls to methods provided by TestComplete (that is, to methods that are provided by TestComplete but not by the application under test)."



    Isn't the save method a method provided by TestComplete? Should I disregard this?