Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. QA Tools
  3. Squish
  4. Detail NameError: name 'test' is not defined when executing Squish Web test case using the Squish IDE
Forum Update on Monday, May 27th 2025

Detail NameError: name 'test' is not defined when executing Squish Web test case using the Squish IDE

Scheduled Pinned Locked Moved Unsolved Squish
2 Posts 2 Posters 399 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikeWat
    wrote on 10 Feb 2025, 17:54 last edited by
    #1

    I am new to Squish and its architecture.
    Whenever I execute a test, I get Script error that refers to a test class name not found.
    More specifically:
    def addMessageToLog(self, message):
    test.log(message)

    test is not found.

    Test Environment:
    Squish IDE 8.0.0
    Build Id: 202406191427
    Python Version being used in from the Squish install folder Squish\python3\python.exe
    Windows 10 Enterprise 21H2
    PYTHONPATH contains the project directory that I am creating tests in.
    System Path contains the Squish python3 folder and Scripts folder.

    Not sure why it cannot find this?

    Thank you .

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JakubTopolski
      wrote on 14 Feb 2025, 23:26 last edited by JakubTopolski
      #2

      Hi Mike,
      I guess you are defining this function in a python module other than test.py. In general you have at least to ways to include such module in your test:

      1. source it - https://doc.qt.io/squish/source-function.html#source-function
      2. use native python imports

      The first approach lets you use your function as it is. However, in most of the cases I recommend using native python import, even though it may require some extra work from you. Your custom Python modules won't have any knowledge of the Squish API until you import the required modules—like the test module you mentioned.

      import test
      def addMessageToLog(self, message):
          test.log(message)
      

      You can learn more about it in the https://qatools.knowledgebase.qt.io/squish/howto/using-squish-functions-python-modules-packages/ knowledge base article.

      ⚙ Test Automation Consultant 🐸 Squish Expert 🐍 Python Enthusiast
      https://cyberalpaca.com
      https://www.linkedin.com/in/jakub-top/

      1 Reply Last reply
      0

      1/2

      10 Feb 2025, 17:54

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved