cancel
Showing results for 
Search instead for 
Did you mean: 

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

Super Contributor

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 5
Highlighted
Community Leader

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

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

Super Contributor

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

@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

 

Community Leader

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

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

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

 

Cheers

Lino

Super Contributor

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

@LinoTadros 

Thanks for the updates . Yes we can use Log.Message(Project.TestItems.Current.Name);

to retrive the current TestItem. But how can we get the Test log for this current TestItem ?

Community Leader

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

You can’t
That is not how Test Logs work in TestComplete. They happen at the end of the entire test and there is no way to log only a specific test item result
You can use Log.SaveResultAs(...) on a specific function but that will report all previous tests as well before the call was issued
In conclusion, you can’t do what you are looking for unless you implement events and create your own report file away from the built in Test Log in TestComplete

Might be a good suggestion for future releases

Cheers
Lino
New Here?
Join us and watch the welcome video:
Join the September Hub-bub to show off, learn and win