Forum Discussion

jrussell's avatar
jrussell
Occasional Contributor
2 years ago

Programatically export test run results to HTML using COM

I am able to run a Project Test Item from a COM (C#) application.  The challenge I have is getting the results from the Project Test Item.  I am able to receive the status of the run(OK, Warning, Error), but I would like to get access to the logs from the run.  I would like to display these results in HTML format.

 

I would like to programmatically export the latest test results to HTML.  I know how to do it via TestComplete UI, but I would like to do this via COM interface.

 

  • You can get the name of the log by calling

     

    IntegrationObject.GetLastResultDescription().LogFileName

     

    It will always point to a xml file called RootLogData.dat

     

    Parse this xml and look for the Prp tag with the attribute name="filename". In the attribute value you will find the name of the log file. Something like this: ="{D7603EDA-C8B8-4006-9D57-F034297D444A}"

     

    This log file is a xml file as well. Now parse this xml and write your desired html code. Every Node tag represents a message line.

     

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Is this relating to TestComplete MSTest or TCUnitTest unit tests?

    • jrussell's avatar
      jrussell
      Occasional Contributor

      This is related to TestComplete

    • jrussell's avatar
      jrussell
      Occasional Contributor

      This relates to running TestComplete Script Unit tests and Test Project Items.

  • jrussell's avatar
    jrussell
    Occasional Contributor

    This is the workflow we would like to have happen.  After we run a test suite, we would like to get these results as HTML.

     

    • jrussell's avatar
      jrussell
      Occasional Contributor

      Unfortunately MHT files are only useful if you use Microsoft Internet Explorer.  I can't have a requirement you need to use Microsoft Internet Explorer to see the results. (Does not work with Microsoft Edge either.)

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I've never had any issues with Edge viewing MTH, but certain users have. There's a discussion here https://community.smartbear.com/t5/TestComplete-Questions/The-latest-version-of-Edge-114-no-longer-always-opens-Mht-files/td-p/251440

     

    Also try, in order for Edge to open MHT files you may need to configure the following:

     

    • Open Microsoft Edge on Windows 10.
    • Click the Settings and More (ellipsis) button on the top-right corner.
    • Select the Settings option.
    • Click on Default browser.
    • Under the “Internet Explorer compatibility” section, turn on the “Allow sites to be reloaded in Internet Explorer mode” toggle switch.
    • Click the Restart button.

     

    • jrussell's avatar
      jrussell
      Occasional Contributor

      MHT files still do not work under Chrome, or Firefox.

      • Henry1's avatar
        Henry1
        Contributor

        jrussellAs this discussion seams to get pointless please feel free to pn me as I'm doing exactly the same thing and have a working solution written in C#.