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. How to call test methods with Python module squishtest?

How to call test methods with Python module squishtest?

Scheduled Pinned Locked Moved Solved Squish
python
2 Posts 1 Posters 133 Views 1 Watching
  • 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
    Markus KS.
    wrote last edited by Markus KS.
    #1

    Hi there. I'm currently evaluating the Python module squishtest with Squish for Web 9.1.1 on Ubuntu 22.04. I followed the setup as described in Using Squish as a module in other Python scripts, applications. Setup worked for me.

    I would like to test a web application. startBrowser(url) works as expected. However, when I try to call one of the test methods, e. g. test.compare(value1, value2), it does not work. The test report is empty. No fails, no passes. I tried calling squishtest.test.compare() instead, but it doesn't work either. See script below.

    Could somebody please give an example how to call the test methods with module squishtest. Thanks in advance.

    import squishtest
    
    squishtest.setTestResult("html", "testresultdir")
    squishtest.testSettings.setWrappersForApplication("__squish__webhook", ["Web"])
    squishtest.startApplication("__squish__webhook")
    squishtest.startBrowser("https://www.google.com/")
    squishtest.waitForApplicationLaunch()
    
    # test.compare("Start", "Stop") # doesn't work
    squishtest.test.compare("Start", "Stop") # does not work either
    
    M 1 Reply Last reply
    0
    • M Markus KS.

      Hi there. I'm currently evaluating the Python module squishtest with Squish for Web 9.1.1 on Ubuntu 22.04. I followed the setup as described in Using Squish as a module in other Python scripts, applications. Setup worked for me.

      I would like to test a web application. startBrowser(url) works as expected. However, when I try to call one of the test methods, e. g. test.compare(value1, value2), it does not work. The test report is empty. No fails, no passes. I tried calling squishtest.test.compare() instead, but it doesn't work either. See script below.

      Could somebody please give an example how to call the test methods with module squishtest. Thanks in advance.

      import squishtest
      
      squishtest.setTestResult("html", "testresultdir")
      squishtest.testSettings.setWrappersForApplication("__squish__webhook", ["Web"])
      squishtest.startApplication("__squish__webhook")
      squishtest.startBrowser("https://www.google.com/")
      squishtest.waitForApplicationLaunch()
      
      # test.compare("Start", "Stop") # doesn't work
      squishtest.test.compare("Start", "Stop") # does not work either
      
      M Offline
      M Offline
      Markus KS.
      wrote last edited by
      #2

      Found it. I overlooked the following traceback in the logs.

      Traceback (most recent call last):                                                                                                                              
        File "/mnt/ssd2/develop/experiments/python-squish/mysquishtest.py", line 16, in <module>                                                                      
          squishtest.waitForApplicationLaunch()                                                                                                                       
      RuntimeError: Waiting for application timed out
      

      When I remove the call squishtest.waitForApplicationLaunch() it works and I can use squishtest.test.compare() to test conditions.

      1 Reply Last reply
      0
      • M Markus KS. has marked this topic as solved

      • Login

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