Forum Discussion

mcpm's avatar
mcpm
Occasional Contributor
25 days ago

Logging issue on TC 15.80 (Python scripts)

Hello,

After being stuck on version 15.67 for a long time (newer versions had the issue I described in this discussion:

RuntimeErrors after upgrading to 15.68.8.7 | SmartBear Community

(I also reported a ticket, but the issue was never fixed, and we didn’t try the workaround from that link because it was too risky for us), we finally decided to upgrade TestComplete to the newest version.

This required some adjustments in our codebase, for example importing "the shim" as described in this article:

https://support.smartbear.com/testcomplete/docs/scripting/specifics/python_tc_globalobjects.html

e.g.:

from tc import Log, Project, ...

We no longer see any RuntimeErrors, so we were happy with this new version. However, we are now facing another issue: “disappearing” Log lines in TestLog during test execution.

It looks like this: at the beginning of the test run all Log lines are present, but over time there are fewer and fewer of them, until TestComplete stops logging entirely.

Scenario:

If I run a group of two tests (let’s call them First and Second):

  • First test contains most of the logs
  • Second test has almost none

But if I run Second and Third:

  • Second test contains most of the logs
  • Third test has almost none

 

You can see the problem in the attached screenshot. In general, only the first few tests produce log entries. After that, Log entries are empty, which is a huge problem for us.

 

Has anyone encountered this issue?

6 Replies

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    While testing Python 3.13 and the global objects, I did come across a similar issue. However, I didn't thoroughly look into it, as I use JavaScript. 

    You'll need to raise a Support Ticket for this, as it is a genuine bug.

  • mcpm's avatar
    mcpm
    Occasional Contributor

    Thanks, I've just opened a support ticket.

  • mcpm's avatar
    mcpm
    Occasional Contributor

    It turned out it’s super easy to reproduce: all you have to do is create a simple script with the following code:

    from tc import Log

    def test_log():

        Log.Message("test message")

    then add it twice as a test item to the execution plan, in one group. Then run this group — you will see the "test message" log only in the first test item.

    • mfoster711's avatar
      mfoster711
      Regular Contributor

      I was able to duplicate your simple example but I noticed the following:

      If you use from tc import Log it only works the first time, as you desribed.

      But, I also tried the following two options and they work fine:
      import tc   # must reference items as tc.Log.Message("test")
      from tc import *

      Lastly, I also noticed that leaving out the import tc and just using Log.Message("test") works and I did not think that would be true in this new version of TestComplete/Python.

      I am a little confused as to what is "proper" with this new version.

      • mfoster711's avatar
        mfoster711
        Regular Contributor

        I need to modify my answer. 

        I noticed leaving out the import and just calling Log.Message("test") works some of the time. If you call one Script from another Script, it will not. I always noticed some oddities when using subfolders to organize my scripts (real folder not just TestComplete fake folders)