Forum Discussion

jsc's avatar
jsc
Regular Contributor
13 years ago

adding logs to a project via jscript

Hi all,



I got 2 questions concerning Test Logs.



1) How can I easily get the testlog-name of the finished test via jscript without browsing through the log-folders on the harddisk checking for the newest one?



2) Can I add a log to a project via jscript? (like manually explained here: Adding and Deleting Log Files)



Kind regards,



Joachim

7 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    1. There is, as far as I know, not really a concept of a "test log name" in TestComplete.  The files themselves are organized in folders with a date/time stamp marking the start of the test run.  Inside those folders, the "main" files all have the same names like "Description.tcLog" and "RootLogData.Dat" with several other supporting files.  To what are you referring when you ask about the "test log name"?  What is your intended use of it?

    2. There is currently no way to do this.  May I ask what your purpose for doing so is?  Maybe there's another way to do what you want.

  • jsc's avatar
    jsc
    Regular Contributor
    Thanks for the quick reply!



    I got 2 testsystems:

    - system1: developing the tests with TestComplete 8

    - system2: running the tests (invoked automatically by a buildserver) with TestExecute 8

    (projects are under version control)



    After a testrun is finished I want to copy the log of the test from system2 to system1 to browse through the errors and teststeps with TestComplete. and re-run (parts of) the failed tests (this is not possible in TestExecute). I do not want to open the project on system2 via my TestComplete on system1 as I do not want to change tests directly on system2.



    Is there an easier possibility to achieve this?








  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    If the log files on the TestExecute system are accessible via network, you can simply, in your TestComplete machine, right click on your Log node in your project explorer and select "Add Existing Log File".  Navigate to your log location and select the corresponding tcLog file.



    Or, you can use Log.SaveResultsAs from your TestExecute machine to export your log file out to another file, such as an MHT file, which can be viewable from anywhere, even outside of TestComplete.  This is how I do it for the most part and it allows me to review the log file from any place, even from home (if placed in the proper drive location) so I can get a set of results.  That MHT file can also be e-mailed so you could distribute the log to a set of analysts.
  • jsc's avatar
    jsc
    Regular Contributor
    This is how I am doing it right now. (adding log manually, exporting and emailing testresults)

    I just thought to automatically add the logs to my project to save those few clicks. :-)
  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Joachim,


    Can I add a log to a project via jscript?


    TestComplete does not allow changing project files during the test run as, in general, this operation may cause malfunctions and data loss.

    As a workaround, you could try creating script code that would insert log file links into appropriate project files, but I would not recommend this as your code will stop working if the internal data format changes. So, what you are doing now is right (exporting and e-mailing results).

  • jsc's avatar
    jsc
    Regular Contributor
    Hi Alex,



    I do not want to add them while the project is opened. I just would add them when the project is closed, as all this would be done in the night.

    But it would just be a nice to have thing. :-)



    Joachim
  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Joachim,


    According to the current work concept, TestComplete deals with open projects only. You are going to work with closed projects, and this contradicts the current concept.


    I agree that it would be nice to have this feature in your case. We always tend to improve our products according to our users' suggestions to make them more powerful and easy-to-use. However, I'm not sure your case is a common practice. I spoke with my friends from the dev and QA teams and they could not recall similar use cases. However, perhaps we are missing some nice feature here. Let's ask other forum members what they think about this. Does anybody use the same approach as Joackim does? Together we could work out a more detailed feature request.