Forum Discussion

anhvu's avatar
anhvu
Frequent Contributor
7 years ago

Unable to process big .txt file.

Hello,

 

I have tested a log file from an app and it is about 100 MB (real life). and TestComplete could not execute it.

 

whenever, I run the script the TestComplete will process it more than 24 hours but still not open it.

 

My Computer: 

Win 7 Pro

Processor: core i7 -4700MQ CPU @ 2.40GHz 2.40GHz

64-bit Operating system

RAM: 16. GB

 

Below is my script:

 

function search_and_Save_Text_by_Lines_for_Diagnostic_Server(path_log,sText_File,sText)
{
var file_read;
var lineData = "";
var i = 1;
var index = 0;
var myfile;
var name = ""
var count = 0;
var special_count = 0;
var startIndex = 0;
var end_value = "";
var textName = "";


file_read = aqFile["OpenTextFile"](path_log + "\\" + sText_File, aqFile["faRead"], aqFile["ctANSI"]);
//Read from the begining of the field
file_read["Cursor"] = 0;

while(! file_read["IsEndOfFile"]())
{
       startIndex = 0;
       //reach each line
       lineData = file_read["ReadLine"]();

      Log["Message"](lineData);

}

//Close the file
myfile["Close"]();
//Close the file
file_read["Close"]();

}

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I would agree with karkadil.

    If your only goal is to get an access to the content of that log file from TestComplete log, you may consider to use Log.File().

  • anhvu's avatar
    anhvu
    Frequent Contributor

    and it seems like unable to stop the execution. When I stopped it, it took me more than 1 hours but still "Stopping....". I have to use task manager to kill TestComplete.

     

    Is there any solution?

     

    Thank you in advance.

     

    Sincerely,

     

    Anh Vu

  • anhvu's avatar
    anhvu
    Frequent Contributor

    Hello,

     

    Never mind.

     

    I got solution.

     

    instead of reading each line, I will read all lines then update my script based on read all procedure.

     

    lineData = file_read["ReadAll"]();

     

    Thank you.

     

    Sincerely,

     

    Anh Vu.

     

     

    • karkadil's avatar
      karkadil
      Valued Contributor

      I think that problem here is not reading the file, but putting all lines to the TestComplete log with Log.Message method.

      Try to comment out that line and the process should go faster.

       

      • anhvu's avatar
        anhvu
        Frequent Contributor

        Thank you all,

         

        The Log.Message I use for testing purpose only.

         

        For big files, if we use ["ReadLine"]() method, TestComplete will no help.