Forum Discussion

nisgupta's avatar
nisgupta
Valued Contributor
5 years ago

Testcomplete + Access the Testlog contents by script if there is error in each projectItems

Has any one access the TestLog contents through the script ?

Goal is After we finished runing the projects which contain 4-5 projectItems and check if each projectItem has errors we want to export the error log and then send it to team about the error of each projectItem .

 

I have looked at the documenation below.

https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/from-tests.html

But this allow only project log. We are looking  to access the Testlog for each project Items and check if there is error in each projectItem.

 

Has any one done this ? It would be great if any one can shared the code /sample ?

cunderw 

 

Thanks

Nishchal

5 Replies

  • LinoTadros's avatar
    LinoTadros
    Community Hero

    The best way to do this on a TestItem level is to implement the "OnLogError" event and in that event use the Builtin.SendMail() funtion in order for you to send an email as soon as an error occurs in a TestItem without even waiting for the entire test to complete.

     

    Cheers

    Lino

    • nisgupta's avatar
      nisgupta
      Valued Contributor

      LinoTadros 

      Thanks for the updates

       

      This is what I am doing. invoking onlogerror when there is error in testItem. Then in onStpTest Events trigger the email . But which testlog we have to attach ?

       

      NG

       

      • LinoTadros's avatar
        LinoTadros
        Community Hero

        in the event itself, you can figure out which TestItem caused the event to happen

        Log.Message(Project.TestItems.Current.Name);

         

        Cheers

        Lino