Testcomplete + Access the Testlog contents by script if there is error in each projectItems
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
Thanks
Nishchal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in the event itself, you can figure out which TestItem caused the event to happen
Log.Message(Project.TestItems.Current.Name);
Cheers
Lino
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
