6장: QSKIP로 테스트 건너뛰기

테스트 함수에서 QSKIP(description) 사용

테스트 함수에서 QSKIP() 매크로를 호출하면 테스트 로그에 실패를 추가하지 않고 테스트 실행을 중지합니다. 실패가 확실한 테스트를 건너뛰는 데 사용할 수 있습니다. QSKIP description 매개변수의 텍스트는 테스트 로그에 추가되며, 테스트가 수행되지 않은 이유를 설명해야 합니다.

구현이 아직 완료되지 않았거나 특정 플랫폼에서 지원되지 않는 경우 테스트를 건너뛰는 데 QSKIP를 사용할 수 있습니다. 알려진 실패가 있는 경우, 가능한 경우 나머지 테스트의 실행을 지원하므로 QEXPECT_FAIL 을 사용하는 것이 좋습니다.

테스트 함수에서 QSKIP의 예:

if (tst_Databases::getMySqlVersion(db).section(QChar('.'), 0, 0).toInt() < 5)
    QSKIP("Test requires MySQL >= 5.0");

데이터 기반 테스트에서 QSKIP()를 호출할 때마다 테스트 데이터의 현재 행만 건너뜁니다. 데이터 기반 테스트에 무조건적인 QSKIP 호출이 포함된 경우, 테스트 데이터의 각 행에 대해 건너뛰기 메시지를 생성합니다.

데이터 함수에서 QSKIP 사용

데이터 함수에서 호출된 경우 QSKIP() 매크로는 _data 함수의 실행을 중지합니다. 이렇게 하면 연결된 테스트 함수가 실행되지 않습니다.

아래 예시를 참조하세요:

    QTest::addColumn<bool>("bool");
    QTest::newRow("local.1") << false;
    QTest::newRow("local.2") << true;

    QSKIP("skipping all");

initTestCase() 또는 initTestCase_data()에서 QSKIP 사용

initTestCase() 또는 initTestCase_data() 에서 호출하는 경우 QSKIP() 매크로는 모든 테스트 및 _data 함수를 건너뜁니다.

테스트를 제외할 적절한 메커니즘 선택도참조하십시오 .

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.