Forum Discussion

Oferv's avatar
Oferv
Super Contributor
15 years ago

Log["SaveResultsAs"](FileName, 1) doesn't save log in HTML format

Hi,



unfortunatly i tried what it says on http://blog.smartbear.com/post/10-03-22/testcomplete-8-sneak-peek-posting-html-messages-to-the-log/ and it didn't create any html format log file.



just copy the following lines to the end of the script and run it.




// the test results in the MHT format

  FileName = Project["ConfigPath"] & "ExportedLog\MyResults.html"

  // Saves the test results

  Log["SaveResultsAs"](FileName, 1)


the script created log but it wasn't html format



can anybody help me creating html log file.

my main goal is to paint the results so it will be easier to view using browser

in order to view the log i used the following lines:




if (aqFile["Exists"](InstallationPath + DDT["CurrentDriver"]["Value"]("File Name")))

      {

        Log["AppendFolder"]("File " + DDT["CurrentDriver"]["Value"]("File Name") +  " exists under " + InstallationPath,  "<html><body><p><b style=\"color : green\">PASS</b></p></body></html>");

        //Log["Message"]("File " + DDT["CurrentDriver"]["Value"]("File Name") +  " exists under " + InstallationPath)

      }

     else

        Log["Message"]("File " + DDT["CurrentDriver"]["Value"]("File Name") +  " does not exist under " + InstallationPath,  "<html><body><p><b style=\"color : red\">FAIL</b></p></body></html>");

please correct me if i'm doing something wrong.

thanks

4 Replies

  • Hi,



    If you use lsHTML (1) as the second parameter of SaveResultsAs, the first parameter must contain the path to the directory where your log should be saved, not the file name. See the Log.SaveResultsAs help topic.
  • Oferv's avatar
    Oferv
    Super Contributor
    Well...



    here is what i changed according to your post:




    // the test results in the MHT format  

      FileName = "C:\Automation\Projects\Corel\Log" Log is the directory where the converted log file should be created

      // Saves the test results

      Log["SaveResultsAs"](FileName, 1)



    and still nothing is created.



    did i get you right?



    Thanks
  • Oferv's avatar
    Oferv
    Super Contributor
    I managed to get a folder a created with many files(xml,gif,js and more) and one of them is html.is that what should be created?

    any way when i open the html file using IE i cant see the effect of the code I've added that should paint the log's rows



    if (aqFile["Exists"](InstallationPath + DDT["CurrentDriver"]["Value"]("File Name"))) 

          { 

            Log["AppendFolder"]("File " + DDT["CurrentDriver"]["Value"]("File Name") +  " exists under " + InstallationPath,  "<html><body><p><b style=\"color : green\">PASS</b></p></body></html>"); 

            //Log["Message"]("File " + DDT["CurrentDriver"]["Value"]("File Name") +  " exists under " + InstallationPath) 

          } 

         else 

            Log["Message"]("File " + DDT["CurrentDriver"]["Value"]("File Name") +  " does not exist under " + InstallationPath,  "<html><body><p><b style=\"color : red\">FAIL</b></p></body></html>");
  • Oferv's avatar
    Oferv
    Super Contributor
    o.k i managed to create the html report but,

    the line 

     Log["AppendFolder"]("File " + DDT["CurrentDriver"]["Value"]("File Name") +  " exists under " + InstallationPath,  "<html><body><p><b style=\"color : green\">PASS</b></p></body></html>"); 



    doesn't paint the specific cell where the message is with green.



    when i open the html report i want to see the cells painted with red/green(depends if it's failed or passed) bgcolor so it will be easier for the viewer to understand what steps were failed and what steps were passed.



    can you write the way to do that cause the above doesn't work



    Thanks