Recording a screen movie of the test execution

Last edited on


Recording a screen movie of the automation that is taking place can come in handy for debugging problems that occur while replaying test scripts.

Squish itself does not include functionality for screen recording yet, but it is generally possible to use external tools that satisfy the individual requirements.

The tool Open Broadcaster Software (OBS Studio, OBS) supports recording from various input sources, including the screen. In addition it has a command line interface, which makes it possible to integrate it with Squish. The rest of this article shows how to integrate screen recording via OBS into Squish test scripts.

Installing OBS

Please refer to Open Broadcaster Software for download and installing OBS.

As of version 19.0.3 OBS supports Linux, macOS and Windows.

Preparing OBS

After installing OBS it needs to be started to perform the initial configuration.

After startup, OBS looks similar to this:

Using OBS from Squish test scripts


(See Executing external applications for starting external processes from test scripts.)


import os.path
import subprocess
import sys

# Adjust these as required:
movies_folder = os.path.expanduser("~")
if sys.platform == "win32":
    movies_folder = os.path.expanduser("~/Videos")

movies_snapshot = []

def main():

def init():
    global movies_snapshot
    movies_snapshot = movies_list()

    test.log("Starting screen recording...")
    test.log("Starting screen recording...done.")

def cleanup():
    test.log("Stopping screen recording...")
    test.log("Stopping screen recording...done.")

    test.log("Waiting for new movie file...")
    global movies_snapshot
    new_found = False
    for i in range(20):
        current_movies = movies_list()
        new_movies = []
        for fn in current_movies:
            if fn not in movies_snapshot:
                new_found = True
                test.log("New movie: %s" % fn)
        if new_found:

def start_screen_recording():
    args = [
            os.path.join(squishinfo.testCase, "..", ""),
    p = subprocess.Popen(args=args)

    # The actual start of the recording takes a few
    # seconds, so wait a bit: 

def stop_screen_recording():
    args = [
            os.path.join(squishinfo.testCase, "..", ""),
    p = subprocess.Popen(args=args)

def movies_list():
    global movies_folder
    list = os.listdir(movies_folder)
    movies = []
    for fn in list:
        if fn.endswith(".flv"):
    return movies

def python_binary():
    python_binary = os.path.join(os.getenv("SQUISH_PREFIX"), "python", "bin", "python"),
    if sys.platform == "win32":
        python_binary = os.path.join(os.getenv("SQUISH_PREFIX"), "python", "python")
    return python_binary

Additional Information

$ obs --help
--help, -h: Get list of available commands.

--startstreaming: Automatically start streaming.
--startrecording: Automatically start recording.
--startreplaybuffer: Start replay buffer.

--collection <string>: Use specific scene collection.
--profile <string>: Use specific profile.
--scene <string>: Start with specific scene.

--studio-mode: Enable studio mode.
--minimize-to-tray: Minimize to system tray.
--portable, -p: Use portable mode.

--verbose: Make log more verbose.
--always-on-top: Start in 'always on top' mode.

--unfiltered_log: Make log unfiltered.

--allow-opengl: Allow OpenGL on Windows.

--version, -V: Get current version.