Forum Discussion

Siax's avatar
Siax
Contributor
12 years ago

HMT log file Grouping

Hi,

I was wondering if there is a way you can group scripts together in the log tree (to create sections). I would like to be able to make the test log more readable as all my actions happen within one script.



Kind regards,

4 Replies

  • Hi Stuart,



    One way I have done this is to assign Folder's to specific tasks inside of the log. You can do this by creating a folder and saving the ID for later use (I use a Project variable for each folder).



    var folder1 = Log.CreateFolder("Folder1");



    Once you have the ID, you can save entries to it like so...



    Log.Message("This is my message.", "", pmNormal, Log.CreateNewAttributes(), "", folder1);



    Hope this helps.

  • Siax's avatar
    Siax
    Contributor
    Hi Mike,

    Thank you very much for this. It is useful but I was actually hoping to have something slightly more clever than that. I have implemented your solution where possible but I still have some roadblocks.



    This is what I'd like:



    Log ("Enquiry Stage")


    KeywordTests.CreateEnquiry.Run();

            KeywordTests.EnquiryToQuotation.Run();

    Log ("Quotation stage")

    KeywordTests.CreateQuotation.Run();

          KeywordTests.QuotationToSalesOrder.Run();
    ...



    So in this case all the keyword tests are grouped in this kind of tree structure.

    At the moment they are all in the log item panel.

    See attached image
  • Hi Stuart,



    Do I get it right that you want to log a message if a keyword test is kicked off? If so, you may want to create another keyword test that will run the needed group of tests and log the appropriate messages before each of the tests from the group is run.
  • avinashs15's avatar
    avinashs15
    Occasional Contributor
    hi,



    You can use push folder and pop folder before alling ur script/keyword



    var FoldID = Log["CreateFolder"](presenttestcase);                                   

                   

               Log["PushLogFolder"](FoldID);

               Runner["CallMethod"](VarToStr(presenttestcase));  

               Log["PopLogFolder"]();  



    here, presenttestcase has the keyword/the script name which will be equivalent to the fodler name