cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
New Contributor

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 ?

image.png

Tried steps as mentioned in given link - 

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

 

Any thoughts?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Staff

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

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)image.png1.1image.png1.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)

image.png2

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. 

image.png3.1image.png3.2

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

image.png4.1image.png4.2image.png4.3

hope this helped Smiley Happy

View solution in original post

3 REPLIES 3
Staff

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

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)Smiley Wink from the OnStopTest event.
- Publish the folder with exported MHT files using either the Publish Build Artifacts or the Publish Pipeline Artifacts task.

New Contributor

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

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.  

image.png

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

 

Staff

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

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)image.png1.1image.png1.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)

image.png2

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. 

image.png3.1image.png3.2

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

image.png4.1image.png4.2image.png4.3

hope this helped Smiley Happy

View solution in original post