diff --git a/plugins/autotest/autotest.qbs b/plugins/autotest/autotest.qbs
index a75f91da6d0a20422fdec333b9ec9094bf02b248..f746d7fae13dc3a99ab6b82c7d01c0fc35984d15 100644
--- a/plugins/autotest/autotest.qbs
+++ b/plugins/autotest/autotest.qbs
@@ -12,6 +12,7 @@ QtcCommercialPlugin {
     Depends { name: "Utils" }
 
     pluginTestDepends: [
+        "QbsProjectManager",
         "QmakeProjectManager"
     ]
 
diff --git a/plugins/autotest/autotest_dependencies.pri b/plugins/autotest/autotest_dependencies.pri
index fd6653ecf1b04b3442222240de34d979be9c9a1f..9410d7795044f56837b0a088ee077167980fa7a3 100644
--- a/plugins/autotest/autotest_dependencies.pri
+++ b/plugins/autotest/autotest_dependencies.pri
@@ -14,6 +14,7 @@ QTC_LIB_DEPENDS += \
     utils
 
 QTC_TEST_DEPENDS += \
+    qbsprojectmanager \
     qmakeprojectmanager \
     qtsupport
 
diff --git a/plugins/autotest/autotestunittests.cpp b/plugins/autotest/autotestunittests.cpp
index 15f32db669c04b275f1ada215a252609b328441a..8878f75418384c5a01d037eb87857bbda9397886 100644
--- a/plugins/autotest/autotestunittests.cpp
+++ b/plugins/autotest/autotestunittests.cpp
@@ -117,6 +117,66 @@ void AutoTestUnitTests::testCodeParser_data()
     QTest::newRow("mixedAutoTestAndQuickTests")
             << QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.pro"))
             << 3 << 5 << 3;
+    QTest::newRow("plainAutoTestQbs")
+            << QString(m_tmpDir->path() + QLatin1String("/plain/plain.qbs"))
+            << 1 << 0 << 0;
+    QTest::newRow("mixedAuotTestAndQuickTestsQbs")
+            << QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.qbs"))
+            << 3 << 5 << 3;
+}
+
+void AutoTestUnitTests::testCodeParserSwitchStartup()
+{
+    QFETCH(QStringList, projectFilePaths);
+    QFETCH(QList<int>, expectedAutoTestsCount);
+    QFETCH(QList<int>, expectedNamedQuickTestsCount);
+    QFETCH(QList<int>, expectedUnnamedQuickTestsCount);
+
+    NavigationWidget *navigation = NavigationWidget::instance();
+    navigation->activateSubWidget(Constants::AUTOTEST_ID);
+
+    CppTools::Tests::ProjectOpenerAndCloser projectManager;
+    for (int i = 0; i < projectFilePaths.size(); ++i) {
+        qDebug() << "Opening project" << projectFilePaths.at(i);
+        CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePaths.at(i), true);
+        QVERIFY(projectInfo.isValid());
+
+        QSignalSpy parserSpy(m_model->parser(), SIGNAL(parsingFinished()));
+        QVERIFY(parserSpy.wait(20000));
+
+        QCOMPARE(m_model->autoTestsCount(), expectedAutoTestsCount.at(i));
+        QCOMPARE(m_model->namedQuickTestsCount(),
+                 m_isQt4 ? 0 : expectedNamedQuickTestsCount.at(i));
+        QCOMPARE(m_model->unnamedQuickTestsCount(),
+                 m_isQt4 ? 0 : expectedUnnamedQuickTestsCount.at(i));
+
+        QCOMPARE(m_model->parser()->autoTestsCount(), expectedAutoTestsCount.at(i));
+        QCOMPARE(m_model->parser()->namedQuickTestsCount(),
+                 m_isQt4 ? 0 : expectedNamedQuickTestsCount.at(i));
+        QCOMPARE(m_model->parser()->unnamedQuickTestsCount(),
+                 m_isQt4 ? 0 : expectedUnnamedQuickTestsCount.at(i));
+    }
+}
+
+void AutoTestUnitTests::testCodeParserSwitchStartup_data()
+{
+    QTest::addColumn<QStringList>("projectFilePaths");
+    QTest::addColumn<QList<int> >("expectedAutoTestsCount");
+    QTest::addColumn<QList<int> >("expectedNamedQuickTestsCount");
+    QTest::addColumn<QList<int> >("expectedUnnamedQuickTestsCount");
+
+    QStringList projects = QStringList()
+            << QString(m_tmpDir->path() + QLatin1String("/plain/plain.pro"))
+            << QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.pro"))
+            << QString(m_tmpDir->path() + QLatin1String("/plain/plain.qbs"))
+            << QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.qbs"));
+
+    QList<int> expectedAutoTests = QList<int>()         << 1 << 3 << 1 << 3;
+    QList<int> expectedNamedQuickTests = QList<int>()   << 0 << 5 << 0 << 5;
+    QList<int> expectedUnnamedQuickTests = QList<int>() << 0 << 3 << 0 << 3;
+
+    QTest::newRow("loadMultipleProjects")
+            << projects << expectedAutoTests << expectedNamedQuickTests << expectedUnnamedQuickTests;
 }
 
 } // namespace Internal
diff --git a/plugins/autotest/autotestunittests.h b/plugins/autotest/autotestunittests.h
index ab2b7c1b9b4df83f8c3995d6038cc0648e9a9874..e359e4175dc4432507d983fa7e464f777d4abbf9 100644
--- a/plugins/autotest/autotestunittests.h
+++ b/plugins/autotest/autotestunittests.h
@@ -43,6 +43,8 @@ private slots:
     void cleanupTestCase();
     void testCodeParser();
     void testCodeParser_data();
+    void testCodeParserSwitchStartup();
+    void testCodeParserSwitchStartup_data();
 
 private:
     TestTreeModel *m_model;
diff --git a/plugins/autotest/autotestunittests.qrc b/plugins/autotest/autotestunittests.qrc
index 6fb5348e544c393c132d0d84f26a38ade631359d..25ce4044feb2a11bfdd2220adbc3298798dd8ce0 100644
--- a/plugins/autotest/autotestunittests.qrc
+++ b/plugins/autotest/autotestunittests.qrc
@@ -28,5 +28,16 @@
         <file>unit_test/mixed_atp/tests/auto/quickauto/quickauto.pro</file>
         <file>unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.pro</file>
         <file>unit_test/mixed_atp/tests/auto/auto.pro</file>
+        <file>unit_test/plain/plain.qbs</file>
+        <file>unit_test/plain/test_plain/test_plain.qbs</file>
+        <file>unit_test/mixed_atp/mixed_atp.qbs</file>
+        <file>unit_test/mixed_atp/src/src.qbs</file>
+        <file>unit_test/mixed_atp/tests/tests.qbs</file>
+        <file>unit_test/mixed_atp/tests/auto/auto.qbs</file>
+        <file>unit_test/mixed_atp/tests/auto/bench/bench.qbs</file>
+        <file>unit_test/mixed_atp/tests/auto/dummy/dummy.qbs</file>
+        <file>unit_test/mixed_atp/tests/auto/gui/gui.qbs</file>
+        <file>unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs</file>
+        <file>unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs</file>
     </qresource>
 </RCC>
diff --git a/plugins/autotest/unit_test/mixed_atp/mixed_atp.qbs b/plugins/autotest/unit_test/mixed_atp/mixed_atp.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..dfc99c15df371bbc411aa23228840c054f662826
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/mixed_atp.qbs
@@ -0,0 +1,8 @@
+import qbs
+
+Project {
+    references: [
+        "src/src.qbs",
+        "tests/tests.qbs"
+    ]
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/src/src.qbs b/plugins/autotest/unit_test/mixed_atp/src/src.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..5ed4dd4a3648ef4d62bb19c556effc5f83078e96
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/src/src.qbs
@@ -0,0 +1,11 @@
+import qbs
+
+CppApplication {
+    type: "application"
+    name: "Dummy Application"
+
+    Depends { name: "Qt.gui" }
+    Depends { name: "Qt.widgets" }
+
+    files: [ "main.cpp" ]
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/auto/auto.qbs b/plugins/autotest/unit_test/mixed_atp/tests/auto/auto.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..a27b3922443f53f84b4177aa631a5cbffeebecd4
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/tests/auto/auto.qbs
@@ -0,0 +1,13 @@
+import qbs
+
+Project {
+    name: "Auto tests"
+
+    references: [
+        "bench/bench.qbs",
+        "dummy/dummy.qbs",
+        "gui/gui.qbs",
+        "quickauto/quickauto.qbs",
+        "quickauto2/quickauto2.qbs"
+    ]
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/bench.qbs b/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/bench.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..d10891316a20ea9478a5595e86d9e1935102f98d
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/bench.qbs
@@ -0,0 +1,14 @@
+import qbs
+
+CppApplication {
+    type: "application"
+    name: "Benchmark Auto Test"
+    targetName: "tst_benchtest"
+
+    Depends { name: "cpp" }
+    Depends { name: "Qt.test" }
+
+    files: [ "tst_benchtest.cpp" ]
+
+    cpp.defines: base.concat("SRCDIR=" + path)
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/auto/dummy/dummy.qbs b/plugins/autotest/unit_test/mixed_atp/tests/auto/dummy/dummy.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..012ba11a67366f404458b6adb75917a0daa3ab6a
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/tests/auto/dummy/dummy.qbs
@@ -0,0 +1,12 @@
+import qbs
+
+CppApplication {
+    type: "application"
+    name: "Dummy auto test"
+    targetName: "tst_FooBar"
+
+    Depends { name: "Qt.test" }
+    Depends { name: "Qt.gui" }
+
+    files: [ "tst_foo.cpp", "tst_foo.h" ]
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/auto/gui/gui.qbs b/plugins/autotest/unit_test/mixed_atp/tests/auto/gui/gui.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..05359cf10fcca286db508834d3fa046d14390937
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/tests/auto/gui/gui.qbs
@@ -0,0 +1,13 @@
+import qbs
+
+CppApplication {
+    name: "Gui auto test"
+    targetName: "tst_gui"
+
+    Depends { name: "Qt"; submodules: [ "gui", "widgets", "test" ] }
+    Depends { name: "cpp" }
+
+    files: [ "tst_guitest.cpp" ]
+
+    cpp.defines: base.concat("SRCDIR=" + path)
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs b/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..1697cd51a2982e52e3a6a338b0deb40cc931f920
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs
@@ -0,0 +1,33 @@
+import qbs
+
+CppApplication {
+    name: "Qt Quick auto test"
+    targetName: "test_mal_qtquick"
+
+    Depends { name: "cpp" }
+    Depends { name: "Qt.core" }
+    Depends {
+        condition: Qt.core.versionMajor > 4
+        name: "Qt.qmltest"
+    }
+
+    Group {
+        name: "main application"
+        condition: Qt.core.versionMajor > 4
+
+        files: [ "main.cpp" ]
+    }
+
+    Group {
+        name: "qml test files"
+        qbs.install: true
+
+        files: [
+            "tst_test1.qml", "tst_test2.qml", "TestDummy.qml",
+            "bar/tst_foo.qml", "tst_test3.qml"
+        ]
+    }
+
+    // this should be set automatically, but it seems as if this does not happen
+    cpp.defines: base.concat("QUICK_TEST_SOURCE_DIR=\"" + path + "\"")
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs b/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..a5fe65fbd65937c612ec04f90afc095e6df3f08e
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs
@@ -0,0 +1,29 @@
+import qbs
+
+CppApplication {
+    name: "Qt Quick auto test 2"
+    targetName: "test_mal_qtquick"
+
+    Depends { name: "cpp" }
+    Depends { name: "Qt.core" }
+    Depends {
+        condition: Qt.core.versionMajor > 4
+        name: "Qt.qmltest"
+    }
+
+    Group {
+        condition: Qt.core.versionMajor > 4
+        name: "main application"
+        files: [ "main.cpp" ]
+    }
+
+    Group {
+        name: "qml test files"
+        qbs.install: true
+
+        files: [ "tst_test1.qml", "tst_test2.qml" ]
+    }
+
+    // this should be set automatically, but it seems as if this does not happen
+    cpp.defines: base.concat("QUICK_TEST_SOURCE_DIR=\"" + path + "\"")
+}
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/tests.qbs b/plugins/autotest/unit_test/mixed_atp/tests/tests.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..e62815789fc813ea189888ba76445a4ab4770042
--- /dev/null
+++ b/plugins/autotest/unit_test/mixed_atp/tests/tests.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+Project {
+    name: "Tests"
+
+    references: [ "auto/auto.qbs" ]
+}
diff --git a/plugins/autotest/unit_test/plain/plain.qbs b/plugins/autotest/unit_test/plain/plain.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..c2fe33618a8edde9df21451912e7798baefcbd20
--- /dev/null
+++ b/plugins/autotest/unit_test/plain/plain.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+Project {
+    name: "Plain test project"
+
+    references: [ "test_plain/test_plain.qbs" ]
+}
diff --git a/plugins/autotest/unit_test/plain/test_plain/test_plain.qbs b/plugins/autotest/unit_test/plain/test_plain/test_plain.qbs
new file mode 100644
index 0000000000000000000000000000000000000000..1b7937ce6a477ddae22f9f4f12befe8c042cb4ec
--- /dev/null
+++ b/plugins/autotest/unit_test/plain/test_plain/test_plain.qbs
@@ -0,0 +1,10 @@
+import qbs
+
+CppApplication {
+    type: "application" // suppress bundle generation on OSX
+
+    Depends { name: "Qt.gui" }
+    Depends { name: "Qt.test" }
+
+    files: [ "tst_simple.cpp", "tst_simple.h" ]
+}