diff --git a/qbs/defaults.js b/qbs/defaults.js
index 5c99f734cd207cb242cc64fbb0be162ca9c96ebd..d64429e3c9fd79413dd1c70fc725bf55b1178fbc 100644
--- a/qbs/defaults.js
+++ b/qbs/defaults.js
@@ -1,22 +1,3 @@
-function testsEnabled(qbs)
-{
-    return qbs.getenv("TEST") || qbs.buildVariant === "debug";
-}
-
-function defines(qbs)
-{
-    var list = [
-        "QT_CREATOR",
-        'IDE_LIBRARY_BASENAME="lib"',
-        "QT_DISABLE_DEPRECATED_BEFORE=0x040900",
-        "QT_NO_CAST_TO_ASCII",
-        "QT_NO_CAST_FROM_ASCII"
-    ]
-    if (testsEnabled(qbs))
-        list.push("WITH_TESTS")
-    return list
-}
-
 // see PluginSpecPrivate::loadLibrary()
 function qtLibraryName(qbs, name)
 {
diff --git a/qtcreator.qbs b/qtcreator.qbs
index 3a1e4b3a0fce785e8633efb4cccc8cedb7353c84..deb1e82391a3142305b418c73b858b599b1f34d1 100644
--- a/qtcreator.qbs
+++ b/qtcreator.qbs
@@ -40,6 +40,14 @@ Project {
     property string ide_bin_path: qbs.targetOS.contains("osx")
             ? ide_app_target + ".app/Contents/MacOS"
             : ide_app_path
+    property bool testsEnabled: qbs.getenv("TEST") || qbs.buildVariant === "debug"
+    property stringList generalDefines: [
+        "QT_CREATOR",
+        'IDE_LIBRARY_BASENAME="lib"',
+        "QT_DISABLE_DEPRECATED_BEFORE=0x040900",
+        "QT_NO_CAST_TO_ASCII",
+        "QT_NO_CAST_FROM_ASCII"
+    ].concat(testsEnabled ? ["WITH_TESTS"] : [])
     moduleSearchPaths: "qbs"
 
     references: [
diff --git a/src/app/app.qbs b/src/app/app.qbs
index 0ad34dc40e003e3b46f34f5f64d5f6b91e53f485..aebc44643eef255adc1fe379c4c650ccd0322492 100644
--- a/src/app/app.qbs
+++ b/src/app/app.qbs
@@ -1,5 +1,4 @@
 import qbs
-import "../../qbs/defaults.js" as Defaults
 
 Application {
     name: project.ide_app_target
@@ -7,7 +6,7 @@ Application {
 
     cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/.."]
                                              : ["$ORIGIN/../lib/qtcreator"]
-    cpp.defines: Defaults.defines(qbs)
+    cpp.defines: project.generalDefines
     cpp.linkerFlags: {
         if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
             return ["-Wl,-s"]
diff --git a/src/libs/QtcLibrary.qbs b/src/libs/QtcLibrary.qbs
index 131c319a28f22ff2c4166b400ef26cb07cf40cc4..45020f4c8e215c89a155505a0c988d914186d0ed 100644
--- a/src/libs/QtcLibrary.qbs
+++ b/src/libs/QtcLibrary.qbs
@@ -4,13 +4,13 @@ import "../../qbs/defaults.js" as Defaults
 DynamicLibrary {
     Depends { name: "cpp" }
     Depends {
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         name: "Qt.test"
     }
 
     targetName: Defaults.qtLibraryName(qbs, name)
 
-    cpp.defines: Defaults.defines(qbs)
+    cpp.defines: project.generalDefines
     cpp.linkerFlags: {
         if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
             return ["-Wl,-s"]
diff --git a/src/libs/qtcomponents/styleitem/styleitem.qbs b/src/libs/qtcomponents/styleitem/styleitem.qbs
index b4b70c84453280ad2cc3b1bd083732083af82eb5..f3c2c8ed227893e11c8159fa9da68cef0b0932db 100644
--- a/src/libs/qtcomponents/styleitem/styleitem.qbs
+++ b/src/libs/qtcomponents/styleitem/styleitem.qbs
@@ -1,5 +1,4 @@
 import qbs.base 1.0
-import "../../../../qbs/defaults.js" as Defaults
 
 DynamicLibrary {
     name: "styleplugin"
@@ -7,7 +6,7 @@ DynamicLibrary {
     Depends { name: "cpp" }
     Depends { name: "Qt"; submodules: ["core", "widgets", "declarative", "script"] }
 
-    cpp.defines: Defaults.defines(qbs)
+    cpp.defines: project.generalDefines
 
     files: [
         "qdeclarativefolderlistmodel.cpp",
diff --git a/src/plugins/QtcPlugin.qbs b/src/plugins/QtcPlugin.qbs
index 830d41b385ed05fae24fd6bdacb4ec8893658906..0ddd27c8aa1ee5e2def962957515781e27663df0 100644
--- a/src/plugins/QtcPlugin.qbs
+++ b/src/plugins/QtcPlugin.qbs
@@ -14,11 +14,11 @@ Product {
     Depends { name: "pluginspec" }
     Depends { name: "cpp" }
     Depends {
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         name: "Qt.test"
     }
 
-    cpp.defines: Defaults.defines(qbs).concat([name.toUpperCase() + "_LIBRARY"])
+    cpp.defines: project.generalDefines.concat([name.toUpperCase() + "_LIBRARY"])
     cpp.installNamePrefix: "@rpath/PlugIns/" + provider + "/"
     cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/../..", "@executable_path/.."]
                                       : ["$ORIGIN", "$ORIGIN/..", "$ORIGIN/../.."]
diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs
index c645f684393e270bb797b56ce983f25435c535cf..3edb01e82ef34e4e6d531d55d8ea1559406e677f 100644
--- a/src/plugins/coreplugin/coreplugin.qbs
+++ b/src/plugins/coreplugin/coreplugin.qbs
@@ -1,6 +1,5 @@
 import qbs.base 1.0
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "Core"
@@ -180,7 +179,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: [
             "testdatadir.cpp",
             "testdatadir.h"
diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs
index 8d9f0525a867105ce6f5dc65f0bea0302d3ef852..c1b3ae2196ece76fbe6af91cb6b9d8c41892ce34 100644
--- a/src/plugins/cppeditor/cppeditor.qbs
+++ b/src/plugins/cppeditor/cppeditor.qbs
@@ -2,7 +2,6 @@ import qbs.base 1.0
 import qbs.FileInfo
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "CppEditor"
@@ -55,7 +54,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: [
             "cppdoxygen_test.cpp",
             "cppquickfix_test.cpp",
diff --git a/src/plugins/cpptools/cpptools.qbs b/src/plugins/cpptools/cpptools.qbs
index b08ac1b250a36b5817d863960c50a613d1ba67eb..ab71d35bdff70c944a1f9363e6b0fe128018e470 100644
--- a/src/plugins/cpptools/cpptools.qbs
+++ b/src/plugins/cpptools/cpptools.qbs
@@ -2,7 +2,6 @@ import qbs.base 1.0
 import qbs.FileInfo
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "CppTools"
@@ -112,7 +111,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: [
             "cppcodegen_test.cpp",
             "cppcompletion_test.cpp",
diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs
index 4b2a8c81fd43297fe0f3cd43a7b8f2e5d0c754c1..05e53edbe7bd0cbcd147855b8a08ae1aa96c9ba1 100644
--- a/src/plugins/debugger/debugger.qbs
+++ b/src/plugins/debugger/debugger.qbs
@@ -1,7 +1,6 @@
 import qbs.base 1.0
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "Debugger"
@@ -26,7 +25,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         qbs.install: true
         qbs.installDir: "tests/manual/debugger/simple/"
         files: ["../../../tests/manual/debugger/simple/simple.pro"]
diff --git a/src/plugins/designer/designer.qbs b/src/plugins/designer/designer.qbs
index e0d27b7a4a62ea84c9680e9ec60371fc6053d115..68b211c7452b2b1c48e4ec56c38d89b698724464 100644
--- a/src/plugins/designer/designer.qbs
+++ b/src/plugins/designer/designer.qbs
@@ -2,7 +2,6 @@ import qbs.base 1.0
 import qbs.FileInfo
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "Designer"
@@ -75,7 +74,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: [ "gotoslot_test.cpp" ]
 
         cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
diff --git a/src/plugins/fakevim/fakevim.qbs b/src/plugins/fakevim/fakevim.qbs
index 17fa0a7e88231a0e51a8e0d4f3c92446b3a9d467..fc9dfcbe7d4beacac1d522ebc4aef920672be518 100644
--- a/src/plugins/fakevim/fakevim.qbs
+++ b/src/plugins/fakevim/fakevim.qbs
@@ -1,7 +1,6 @@
 import qbs.base 1.0
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "FakeVim"
@@ -23,7 +22,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: ["fakevim_test.cpp"]
     }
 }
diff --git a/src/plugins/locator/locator.qbs b/src/plugins/locator/locator.qbs
index bf45c20b5aa71232bf2a09faac4afeaff4ee656a..b4ff3f5923f8cd19c5a3ffefa7da4e28fe154a2a 100644
--- a/src/plugins/locator/locator.qbs
+++ b/src/plugins/locator/locator.qbs
@@ -2,7 +2,6 @@ import qbs.base 1.0
 import qbs.FileInfo
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "Locator"
@@ -49,7 +48,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: [
             "locatorfiltertest.cpp",
             "locatorfiltertest.h",
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index 9959bd3b13e41a9a6bbd20ad1e9226f8a3716f5a..2a177eb6344a25a29178036e518b367068f8421e 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -1,7 +1,6 @@
 import qbs.base 1.0
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "ProjectExplorer"
@@ -241,7 +240,7 @@ QtcPlugin {
 
     Group {
         name: "WindowsToolChains"
-        condition: qbs.targetOS.contains("windows") || Defaults.testsEnabled(qbs)
+        condition: qbs.targetOS.contains("windows") || project.testsEnabled
         files: [
            "abstractmsvctoolchain.cpp",
            "abstractmsvctoolchain.h",
@@ -258,7 +257,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: ["outputparser_test.h", "outputparser_test.cpp"]
     }
 
diff --git a/src/plugins/qmljstools/qmljstools.qbs b/src/plugins/qmljstools/qmljstools.qbs
index 3f0adb21bbe050d238f591b52d04084b9aa8e4ec..3a2b06a33eb4ed4098aaf1d72d0d1b2df4f59f03 100644
--- a/src/plugins/qmljstools/qmljstools.qbs
+++ b/src/plugins/qmljstools/qmljstools.qbs
@@ -1,7 +1,6 @@
 import qbs.base 1.0
 
 import "../QtcPlugin.qbs" as QtcPlugin
-import "../../../qbs/defaults.js" as Defaults
 
 QtcPlugin {
     name: "QmlJSTools"
@@ -73,7 +72,7 @@ QtcPlugin {
 
     Group {
         name: "Tests"
-        condition: Defaults.testsEnabled(qbs)
+        condition: project.testsEnabled
         files: ["qmljstools_test.cpp"]
     }
 
diff --git a/src/tools/QtcTool.qbs b/src/tools/QtcTool.qbs
index 4b2a4b26ef3167f2df9378b2edd81e776ec695d8..d9b25e794cdf967da9e7c0010cab663d5ffe8ab4 100644
--- a/src/tools/QtcTool.qbs
+++ b/src/tools/QtcTool.qbs
@@ -1,10 +1,9 @@
 import qbs.base 1.0
-import "../../qbs/defaults.js" as Defaults
 
 Application {
     type: "application" // no Mac app bundle
     Depends { name: "cpp" }
-    cpp.defines: Defaults.defines(qbs)
+    cpp.defines: project.generalDefines
     cpp.linkerFlags: {
         if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))
             return ["-Wl,-s"]