Qt Test Reference Documentation

CMake/Testing With CTest

Catch2, version 2.13.10

Changes to Qt Test

Touch-related functionality

The QTouchEventSequence class

Chapter 1: Writing a Unit Test

Writing a Test

Preparing the Stand-Alone Executable

Building the Executable

Building with CMake

Building with qmake

Running the Executable

Chapter 2: Data Driven Testing

Writing the Data Function

Rewriting the Test Function

Preparing the Stand-Alone Executable

Building the Executable

Building with CMake

Building with qmake

Running the Executable

Chapter 3: Simulating GUI Events

Writing a GUI Test

Preparing the Stand-Alone Executable

Building the Executable

Building with CMake

Building with qmake

Running the Executable

Chapter 4: Replaying GUI Events

Writing the Data Function

Rewriting the Test Function

Preparing the Stand-Alone Executable

Building the Executable

Building with CMake

Building with qmake

Running the Executable

Chapter 5: Writing a Benchmark

Writing a Benchmark

Data Functions

Building the Executable

Building with CMake

Building with qmake

Running the Executable

Chapter 6: Skipping Tests with QSKIP

Using QSKIP(description) in a test function

Using QSKIP in a _data function

Using QSKIP from initTestCase() or initTestCase_data()

Coco

Cycle, version 3.3.10

Googletest Mocking (gMock) Framework

Linux Performance Events, version 6.13

Usage

Verifying Signal Emissions

QT_SKIP_DEFAULT_TESTCASE_DIRS

cmake-target-property-QT_SKIP_DEFAULT_TESTCASE_DIRS

QT_SKIP_DEFAULT_TESTCASE_DIRS

cmake-variable-QT_SKIP_DEFAULT_TESTCASE_DIRS

Qt Test

Using the Module

Building with CMake

Building with qmake

Articles and Guides

Reference

Module Evolution

Licenses and Attributions

Qt Test Best Practices

General Principles

Verify Tests

Give Test Functions Descriptive Names

Write Self-contained Test Functions

Test the Full Stack

Make Tests Complete Quickly

Use Data-driven Testing

Use Coverage Tools

Select Appropriate Mechanisms to Exclude Tests

Avoid Q_ASSERT

Writing Reliable Tests

Avoid Side-effects in Verification Steps

Avoid Fixed Timeouts

Beware of Timing-dependent Behavior

Avoid Bitmap Capture and Comparison

Improving Test Output

Test for Warnings

Avoid Printing Debug Messages from Autotests

Write Well-structured Diagnostic Code

Writing Testable Code

Break Dependencies

Compile All Classes into Libraries

Setting up Test Machines

Screen Savers

System Dialogs

Display Usage

Window Managers

Qt Test Overview

Creating a Test

Increasing Test Function Timeout

Building a Test

Building with CMake and CTest

Building with qmake

Building with Other Tools

Qt Test Command Line Arguments

Syntax

Options

Logging Options

Test Log Detail Options

Testing Options

Benchmarking Options

Miscellaneous Options

Qt Test Environment Variables

Creating a Benchmark

Selecting the Measurement Back-end

Using Global Test Data

Qt Test Tutorial

Qt Test module topics

Valgrind, version 3.25.1

gcov

CMake Target Properties in Qt6 Test

CMake Variables in Qt6 Test

Qt Test C++ Classes

QtTest