Commit 1a986451 authored by Nikolai Kosjar's avatar Nikolai Kosjar

C++: Tests: Add stupid "do xyz for each file/token" tests

Introduce tests that execute test actions on each word/token of each
file from every loaded project. Currently, besides just opening files
and moving token by token through the files, the following basic actions
from the CppTools and CppEditor plugin are executed for each token:

    - Follow Symbol Under Cursor
    - Switch Declaration/Definition
    - Find Usages
    - Rename Symbol Under Cursor
    - Open Type Hierarchy
    - Invoke Completion
    - Trigger a quick fix in this scope (+perform)

Note that

(1) These tests are meant to detect corner cases for which Qt Creator
    crashes or outputs QTC_ASSERTS. Correct behavior is not tested.

(2) These tests operate on the loaded projects. Therefore, projects
    should be specified on the command line or should be loaded by the
    session manager. Depending on the projects size, these tests might
    be quite time consuming and are therefore candidates for nightly

    Suggested test projects are,

Change-Id: I550776b3d56acb17ab337da068d409bfc21e997a
Reviewed-by: default avatarDavid Schulz <>
parent c388c05b
......@@ -47,7 +47,8 @@ OTHER_FILES += CppEditor.mimetypes.xml
equals(TEST, 1) {
cppquickfix_test.cpp \
cppdoxygen_test.cpp \
......@@ -65,7 +65,8 @@ QtcPlugin {
condition: Defaults.testsEnabled(qbs)
files: [
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
......@@ -86,13 +86,13 @@ public slots:
void setSortedOutline(bool sorted);
private slots:
void onTaskStarted(const QString &type);
void onAllTasksFinished(const QString &type);
void currentEditorChanged(Core::IEditor *editor);
private slots:
// The following tests expect that no projects are loaded on start-up.
void test_doxygen_comments_qt_style();
void test_doxygen_comments_qt_style_continuation();
void test_doxygen_comments_java_style();
......@@ -130,6 +130,19 @@ private slots:
void test_quickfix_AddIncludeForUndefinedIdentifier_noinclude();
void test_quickfix_AddIncludeForUndefinedIdentifier_noincludeComment01();
void test_quickfix_AddIncludeForUndefinedIdentifier_noincludeComment02();
// The following tests depend on the projects that are loaded on startup
// and will be skipped in case no projects are loaded.
void test_openEachFile();
void test_switchHeaderSourceOnEachFile();
void test_moveTokenWiseThroughEveryFile();
void test_moveTokenWiseThroughEveryFileAndFollowSymbol();
void test_moveTokenWiseThroughEveryFileAndSwitchDeclarationDefinition();
void test_moveTokenWiseThroughEveryFileAndFindUsages();
void test_moveTokenWiseThroughEveryFileAndRenameUsages();
void test_moveTokenWiseThroughEveryFileAndOpenTypeHierarchy();
void test_moveTokenWiseThroughEveryFileAndInvokeCompletion();
void test_moveTokenWiseThroughEveryFileAndTriggerQuickFixes();
#endif // WITH_TESTS
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment