Forum Discussion

jinithlal's avatar
jinithlal
Contributor
13 years ago

Creating html reports

I am having an issue with generating html files through scripts (VBScript) as it is not appending lines after a certain number of lines are added to the file (600 approx, I am putting the data in a table which has more than 600 rows, but the first 600 rows are added in html)

I am using aqFile.WriteToTextFile("","",aqFile.ctUnicode) for adding lines to html file as I need to display some other language characters in the Output.



Please help, Thank you
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Jinithlal,



    Please post here the complete script you're using, and we'll try to figure out what's going wrong.
  • Thank you Helen,

    I think the issue was related to memory usage by the application, as I am getting error message saying 'Not enough memory available to process this command'

    Attaching The task Manager Screenshots for ref.



    Please find the code in the attachment



    Thank you.
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Jinithlal,



    The code you posted lacks an important piece - the context where these functions are used, which would show how many times they're called, what Value's of which length are being written by AddHtml_Results, etc. Without seeing the complete script you're using, it's difficult to figure out why it's failing.



    One thing you can try is to reorganize the file I/O operations to open and close the file only once during the entire test instead of using aqFile.WriteToTextFile that opens/closes the file each time data is being written (see Alex Kuzin's explanation here). This may improve the file writing performance. For example, try rewriting your script in the following way:

    Sub Main

      Dim oFile

      ' Open the file

      Set oFile = aqFile.OpenTextFile(strFileName, aqFile.faWrite, aqFile.ctUnicode)



      ' Write data to the file

      Call PageHeader(oFile)

      ...

      Call PageFooter(oFile)



      ' Close the file

      oFile.Close

    End Sub





    ' Modify PageHeader, AddHtml_Results and PageFooter as follows:

    Sub PageHeader(resfile)

      Call resfile.WriteLine("<html>")

      ...

      Call resfile.WriteLine(<table width=90% border=2 bordercolor=#000000 id=table1 bordercolorlight=#000000>")

    End Sub


    If this doesn't help you solve the issue, please post here the entire script and the incorrectly generated HTML file. If you can't post them to a public forum, you can send them privately to our Support Team using this form.





    I think the issue was related to memory usage by the application, as I am getting error message saying 'Not enough memory available to process this command'
    It's difficult to say whether the two issues are related. Is this error displayed by your tested application or by TestComplete? Does this error occur during the HTML report generation or at some other moment during the test run?
    • JackSparrow's avatar
      JackSparrow
      Frequent Contributor

      Hi jinithlal

       

      Am also looking for this type of HTML reporting actually i need some more help since am new to everything, after checking the code which you wrote

      Sub PageHeader(resfile)
      
      Call aqFile.WriteToTextFile(resfile, "<html>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "<head>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "<title> Automation Results </title>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "</head>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "<body>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "<table width=90% border=2 bordercolor=" & "#000000 id=table1  bordercolorlight=" & "#000000>", aqFile.ctUnicode)
      
      End Sub
      
      
      Sub AddHtml_Results(resfile,Value)
      
      
      Call aqFile.WriteToTextFile(resfile, "<tr>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "<td width=80%  bgcolor = #000000  >", aqFile.ctUnicode) 
      
      Call aqFile.WriteToTextFile(resfile, value, aqFile.ctUnicode)
      
      Call aqFile.WriteToTextFile(resfile, "</td>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "</tr>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "</table>", aqFile.ctUnicode)
      
      End Sub
      
      Sub PageFooter(resFile)
      
      Call aqFile.WriteToTextFile(resfile, "</body>", aqFile.ctUnicode)
      Call aqFile.WriteToTextFile(resfile, "</html>", aqFile.ctUnicode)
      
      End Sub

      Actually what exactly we need to give in the test case for the values resFile and Value , can you please let me know