Forum Discussion

TCU100's avatar
TCU100
Occasional Contributor
5 years ago

Exec TestComplete Tests using Azure pipeline, and get test results as attachment for each test

 

Hi, 
I am running TestComplete Tests using Azure pipeline, I only get .mht file as attachment when a test fails. How can I get all .mht files for each test as attachment ?

Tried steps as mentioned in given link - 

https://support.smartbear.com/testcomplete/docs/working-with/integration/azure/test-adapter/index.html

 

Any thoughts?

 

  • I understand how that could seem counter-intuitive. The simple green poriton of the pie chart for the tests that passed does seem like it doesn't carry too much information. However, the workaround mentioned above does work, as I have tested it out. 

    Attached are the following:

    1) OnStopEvent : for creating mht files after the completion of every test case in your project, and saving them into a desired location (you can add event handlers by going to the project level, right click add item, event handler)1.11.2

    2) Delete old mht files script: so that if your test cases in your project ends up having different names, you aren't publishing irrelevent mht files for a subsequent build (possibly cluttering it with lots of old mht's)

    2

    3) Publish Artifact directory path - this is really up to you and how your workflow is... I pull my test cases from git, and the mhts from (1) gets stored within $(Build.Directory.LocalPath)\TestProject1\MHT_Files - so i point it that way. you can look up predefined variables like Build.Directory in the microsoft azure devops documentations page. 

    3.13.2

    4) Artifacts & the mht files for the passed test cases. 

    4.14.24.3

    hope this helped :)

  • In the current implementation, the TC-Azure DevOps integration only uploads unsuccessful logs, so there is no way to obtain the logs for successful runs. The thing is that the entire integration relies on test cases, not projects. So, when you trigger the execution from Azure DevOps, TestComplete runs each test case individually (so instead of running the entire project it launches the first test case, stops, launches the second test case, stops etc.). Thus, we have multiple MHT logs and cannot compile a single MHT log.If you want to get all the MHT files (from all test cases), I suggest that the following:

    - Export the log to MHT at the end of each test case and save it to some folder within the project suite. For example, you can call the Log.SaveResultsAs method (Log.SaveResultsAs(ProjectSuite.Path + "MHT_Files\\" + aqTestCase.CurrentTestCase.Name  + ".mht", lsMHT);) from the OnStopTest event.
    - Publish the folder with exported MHT files using either the Publish Build Artifacts or the Publish Pipeline Artifacts task.

    • TCU100's avatar
      TCU100
      Occasional Contributor

      Thanks for your response. 

      The thing is that the entire integration relies on test cases, not projects. So, when you trigger the execution from Azure DevOps, TestComplete runs each test case individually (so instead of running the entire project it launches the first test case, stops, launches the second test case, stops etc.) - This is how I expect is to run. Thus, we have multiple MHT logs and cannot compile a single MHT log -  I don’t expect single mht file, it could be one mht file per test. If we get mht logs for failing tests, why not for successful?

      What if someone want to see details of successful test, it does not make any sense to go different places based on test status. All mht report files in one location will be much easier for end user.  

       Publish Build Artifacts or the Publish Pipeline Artifacts task. seems reasonable workaround. I will try it shortly. 

       

      • hkim5's avatar
        hkim5
        Staff

        I understand how that could seem counter-intuitive. The simple green poriton of the pie chart for the tests that passed does seem like it doesn't carry too much information. However, the workaround mentioned above does work, as I have tested it out. 

        Attached are the following:

        1) OnStopEvent : for creating mht files after the completion of every test case in your project, and saving them into a desired location (you can add event handlers by going to the project level, right click add item, event handler)1.11.2

        2) Delete old mht files script: so that if your test cases in your project ends up having different names, you aren't publishing irrelevent mht files for a subsequent build (possibly cluttering it with lots of old mht's)

        2

        3) Publish Artifact directory path - this is really up to you and how your workflow is... I pull my test cases from git, and the mhts from (1) gets stored within $(Build.Directory.LocalPath)\TestProject1\MHT_Files - so i point it that way. you can look up predefined variables like Build.Directory in the microsoft azure devops documentations page. 

        3.13.2

        4) Artifacts & the mht files for the passed test cases. 

        4.14.24.3

        hope this helped :)