CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

testland/qt-test-framework

Use whenever Qt C++ code needs unit or GUI tests in-process: Qt Test entry macros, private-slot test functions, QVERIFY, QCOMPARE and data-driven QFETCH, simulated mouse, key and touch events, QSignalSpy, QBENCHMARK and JUnit XML output for CI, including Qt Quick and QML logic.

Quality

94%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

qt-gui-signal-benchmark.mdreferences/

qt-test-framework - GUI events, benchmarks, and CI

Reference detail kept out of the SKILL spine. See SKILL.md for the core author -> run -> parse flow (including the runnable GUI and QSignalSpy examples).

Sources: Qt Qt Test overview, QTest namespace.

GUI event-simulation functions (qtns)

FamilyFunctions
KeyboardkeyClick, keyPress, keyRelease, keyEvent, keySequence, keyClicks
MousemouseClick, mousePress, mouseRelease, mouseMove, mouseDClick
TouchtouchEvent, createTouchDevice
WheelwheelEvent (Qt 6.8+)

QTRY_VERIFY / QTRY_COMPARE poll a predicate with a default 5-second timeout - the primitive for waiting on async signal/slot completion without ad-hoc QTest::qWait sleeps.

Benchmarks

QBENCHMARK executes a code block repeatedly to measure performance; Qt Test reports CPU time, walltime, or instructions-retired depending on the active back-end (qtover). For a single-run measurement use QBENCHMARK_ONCE (qtns).

void TestCalculator::benchmarkLargeSum() {
    Calculator c;
    QBENCHMARK {
        for (int i = 0; i < 1000; ++i) {
            c.add(i, i);
        }
    }
}

Keep benchmark slots separate from correctness slots so iteration counts do not mask regressions; gate on regression in CI.

CI integration

QT_QPA_PLATFORM=offscreen is the headless Qt platform plugin - required for GUI-touching Qt Test executables on hosted Linux runners with no X / Wayland session.

# .github/workflows/qttest.yml
jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v5
      - name: Install Qt
        uses: jurplel/install-qt-action@v4
        with: { version: '6.7.0' }
      - name: Configure
        run: cmake -B build -DCMAKE_BUILD_TYPE=Release
      - name: Build
        run: cmake --build build --parallel
      - name: Run tests (Linux with offscreen)
        if: runner.os == 'Linux'
        env:
          QT_QPA_PLATFORM: offscreen
        run: ctest --test-dir build --output-on-failure --output-junit junit.xml
      - name: Run tests (Windows/macOS)
        if: runner.os != 'Linux'
        run: ctest --test-dir build --output-on-failure --output-junit junit.xml
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: junit-${{ matrix.os }}
          path: build/junit.xml

SKILL.md

tile.json