Forum Discussion

rajendermehta's avatar
rajendermehta
Occasional Contributor
14 years ago

Logging test result to a database

Hi



Please explain me the method to save test results into a database in either keyword test or script test. Is there any provision to modify the architecture of Test Complete for embedding test results logging capabilities?



Kindly help!



Thanks,

Rajender Mehta

Agilent Technologies, India

4 Replies


  • Hi Rajender,





    TestComplete does not have a built-in ability to export results to a database, and we do not have a sample script demonstrating how to do this. I have registered a suggestion in our database. If you need this feature, I think that you can try to create a script that will pass results to a database. To read results of the current test execution, you can export them to external files and parse these files. Please see the Log.SaveResultsAs help topic.





    Another possibility is to make use of the 'OnLog*' event handlers. Every time a message is posted to the log, the corresponding handler is invoked, and you can write data to a database from this handler. Please see the About Events and Event Handling and OnLogMessage Event help topics.
  • rajendermehta's avatar
    rajendermehta
    Occasional Contributor
    Hello David,



    Thanks for your quick responce. I think the second option, adding event handler script and handling the result in that script, is quite a viable option.



    I have also designed a sample application for the same for trying your suggestion. I have added an OnLogError event handler for running my custom script.  



    There are two parameter passed to the eventhandler method 1. Sender, 2. LogParams.



    But, I am facing a problem here, as I stops on the breakpoint added OnEvent Handler script, I dont't have any access to the TestCase information i.e. with which test case this error is associated.



    Kindly help me in understanding as above.



    Thanks,

    Rajender

  • Hi Rajender,





    If your test cases are implemented with test items, you can use the 'Project.TestItems.Current.Name' code to get the name of the current test item. If you implement your test cases without using test items, I recommend that you consider using them. Please find more information in the Tests and Test Items help topic.