Ask a Question

Log folder equivalent of Indicator.Clear()

SOLVED
tphillips
Frequent Contributor

Log folder equivalent of Indicator.Clear()

Is there an equivalent of Indicator.Clear() for Log Folders? How can I add a Log folder to the outermost logs without having to call Log.PopLogFolder() lots of times in a loop?

 

For now the solution I have come up with is to pass a negative value (e.g. -1000) to the Log.CreateFolder() OwnerFolderID argument.

There must be a better way, right?


--------------------
Senior SQA Automation Engineer
6 REPLIES 6
sonya_m
SmartBear Alumni (Retired)

That's a great question Thomas! Let's see if the Community has ideas.

 

@AlexKaras @BenoitB @Marsha_R @tristaanogre 

What do you think?


Sonya Mihaljova
Community and Education Specialist

AlexKaras
Community Hero

Hi,

 

There must be a better way, right?

Passing (-1) as the value for the OwnerFolderID is a documented way to create a folder at the top of hierarchy.

Personally I usually ensure that the folder is 'popped' after its use is over.

For the folder(s) that can be used throughout test code (for example, the folder that stores test context) I keep its id in a variable/array like in the example code https://support.smartbear.com/testcomplete/docs/reference/project-objects/test-log/log/appendfolder....

 

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
================================
tphillips
Frequent Contributor

I thought -1 is the default, which means the parent should be the last folder (unless the default folder is not set)

Can we unset the default folder?

 

OwnerFolderID

Identifier of the test log’s folder where a new folder will be created as a subfolder. To get this identifier, use the CreateFolder or AppendFolder method (they will create the parent folder). If this parameter refers to a non-existent folder, is omitted or is set to -1 (the default value), the AppendFolder method will either create the folder in the default folder of the test log or append it to the test log outside of any other folder (if the default folder is not set). The default folder is the folder that is currently at the top of the folder stack which is populated during the script run. To push a folder to or pop it out of this stack, use the PushLogFolder or the PopLogFolder method correspondingly.

 

Maybe I am missing something?


--------------------
Senior SQA Automation Engineer

To say the truth, I also was confused with this section of documentation.

On the one hand, documentation talks about about non-existent folder ID *or* set to -1. On the other hand, you are saying that value like -1000 always creates new folder outside of all existing folder's hierarchy...

Also, according to the documentation, I am not sure that default folder can be 'unset' (i.e. set to default) by any other means than 'popping' all 'pushed' folders.

I also not sure if it is possible to get an id of the 'system default' folder (i.e. the one that is used at the test start).

 

@sonya_m : Sonya, could you ask documentation team to clarify this section of documentation please?

 

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
================================
tphillips
Frequent Contributor

For now, I have created a feature request:

https://community.smartbear.com/t5/TestComplete-Feature-Requests/Add-PopAllFolders-function-for-test...


--------------------
Senior SQA Automation Engineer
sonya_m
SmartBear Alumni (Retired)

Thank you for pointing this out! I've asked the doc team to look into this! @AlexKaras 

@tphillips I'll mark the feature request comment as a solution for now to make it more visible


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: