Ask a Question

How do we save a folder from testcomplete log file through script

rajulapati
Contributor

How do we save a folder from testcomplete log file through script

I have multiple folders created in my Results Log Folder  and I want to export the each particular folder separately into a a different paths.

Can we do this through VB script? Do we have any methods to try this approach?

 

I have attached an example screenshot of how the result file will look. As per the example I would like to export Folder0 separately into a different path. Samething for Folder 1 & Folder2.

10 REPLIES 10
Marsha_R
Community Hero

Re: How to we save a folder from testcomplete log file through script

This may be helpful:

https://support.smartbear.com/testcomplete/docs/reference/project-objects/test-log/log/saveresultsas...

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
rajulapati
Contributor

Re: How to we save a folder from testcomplete log file through script

Thank you @Marsha_R  for the reply. All the Test log is from one Script /Test item. So when i use Log.Save as option it is exporting the total log for that Test item.

I am trying to export only part of the log(ex: Folder-1) from the log created for Test item. 

Marsha_R
Community Hero

Re: How to we save a folder from testcomplete log file through script

You can export it in different places in the log, but you would get it incrementally. So first Folder 1, then Folder 1 + Folder 2, etc.

 

I don't see a way to do it inside TestComplete, but what you could do is export the whole log to XML, then parse the XML into the folder parts.  Here's the way to interpret the log file.

https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/exporting/structure.ht...

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
rajulapati
Contributor

Re: How to we save a folder from testcomplete log file through script

We can get the xml result only when we run though command line . So I assume , we cannot export part of the log file which I was trying.

Thank you for the response

Marsha_R
Community Hero

Re: How to we save a folder from testcomplete log file through script

You can get an xml log from inside a test

https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/exporting/index.html#x...

 

XML

You can also export test results to an XML format file from tests by using the Log.SaveResultsAs method:

 

Log.SaveResultsAs("C:\\Work\\Log\\Log.xml", lsXML);

 
  •  

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
rajulapati
Contributor

Re: How to we save a folder from testcomplete log file through script

Thank you @Marsha_R  I was able to export it to xml format. When I try to remove the child nodes in xml, the log messages that were generated below it are all deleted from result file.  Ex: if I tried to remove all the child nodes of Folder 0, I dont see log messages generated after Folder 0.

I tried manually  deleting the nodes from the xml file and see the same issue.

 

Is my approach correct or do I need to do something different?

Attached is the xml file for reference.

Marsha_R
Community Hero

Re: How to we save a folder from testcomplete log file through script

I have not done this myself, but what others have described is parsing the xml to extract the information you need and putting it in a document of your own format.

 

@AlexKaras Do you know how to build a report like this?

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
rajulapati
Contributor

Re: How to we save a folder from testcomplete log file through script

Thank you @Marsha_R  I will try to create my Own result and see if it works

AlexKaras
Community Hero

Re: How to we save a folder from testcomplete log file through script

Hi,

 

@AlexKaras Do you know how to build a report like this?

No, I did not try this either and I don't have any idea better than already suggested by Marsha - export test log to XML and modify / transform it as needed.

 

P.S. Check if this option would work for you: https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/from-tests.html

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: