diff --git a/plugins/TestRunner/templates/travis.yml.twig b/plugins/TestRunner/templates/travis.yml.twig
index e8d4c7aa6ffe21aa40c35898e7f12eea48609c8a..3754829c3e11d944487a5f349112a08ac2da093c 100644
--- a/plugins/TestRunner/templates/travis.yml.twig
+++ b/plugins/TestRunner/templates/travis.yml.twig
@@ -90,17 +90,7 @@ install:
   - git clone -q https://github.com/piwik/piwik.git piwik
   - cd piwik
   - git fetch -q --all
-  - | 
-    if [ "$TEST_AGAINST_PIWIK_BRANCH" == "" ]; then
-        if [ "$TEST_AGAINST_CORE" == "latest_stable" ]; then
-            export TEST_AGAINST_PIWIK_BRANCH=$(git describe --tags `git rev-list --tags --max-count=1`)
-            export TEST_AGAINST_PIWIK_BRANCH=`echo $TEST_AGAINST_PIWIK_BRANCH | tr -d ' ' | tr -d '\n'`
-        else
-            export TEST_AGAINST_PIWIK_BRANCH=master
-        fi
-    fi
-  - echo "Testing against '$TEST_AGAINST_PIWIK_BRANCH'"
-  - git checkout "$TEST_AGAINST_PIWIK_BRANCH" -q
+  - ./tests/travis/checkout_test_against_branch.sh
   - git submodule init -q
   - git submodule update -q || true
 {% else %}
diff --git a/tests/travis/checkout_test_against_branch.sh b/tests/travis/checkout_test_against_branch.sh
new file mode 100644
index 0000000000000000000000000000000000000000..616a7750466d78d4a4f40c16453b0cc2e0d51120
--- /dev/null
+++ b/tests/travis/checkout_test_against_branch.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+SCRIPT_DIR=`dirname $0`
+
+if [ "$TEST_AGAINST_PIWIK_BRANCH" == "" ]; then
+    if [ "$TEST_AGAINST_CORE" == "latest_stable" ]; then # test against the latest stable release of piwik core (including betas & release candidates)
+        export TEST_AGAINST_PIWIK_BRANCH=$(git describe --tags `git rev-list --tags --max-count=1`)
+        export TEST_AGAINST_PIWIK_BRANCH=`echo $TEST_AGAINST_PIWIK_BRANCH | tr -d ' ' | tr -d '\n'`
+    elif [[ "$TEST_AGAINST_CORE" == "minimum_required_piwik" && "$PLUGIN_NAME" != "" ]]; then # test against the minimum required Piwik in the plugin.json file
+        export TEST_AGAINST_PIWIK_BRANCH=$(php "$SCRIPT_DIR/get_required_piwik_version.php" $PLUGIN_NAME)
+    else
+        export TEST_AGAINST_PIWIK_BRANCH=master
+    fi
+fi
+
+echo "Testing against '$TEST_AGAINST_PIWIK_BRANCH'"
+git checkout "$TEST_AGAINST_PIWIK_BRANCH" -q
diff --git a/tests/travis/get_required_piwik_version.php b/tests/travis/get_required_piwik_version.php
new file mode 100644
index 0000000000000000000000000000000000000000..4a7197673b7493febc5bd893e3acb24bbad97697
--- /dev/null
+++ b/tests/travis/get_required_piwik_version.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+// tiny script to get plugin version from plugin.json from a bash script
+$pluginName = $argv[1];
+$pluginJsonPath = __DIR__ . "/../../plugins/$pluginName/plugin.json";
+
+$pluginJsonContents = file_get_contents($pluginJsonPath);
+$pluginJsonContents = json_decode($pluginJsonContents, true);
+
+$minimumRequiredPiwik = @$pluginJsonContents["require"]["piwik"];
+
+if (empty($minimumRequiredPiwik)) {
+    $minimumRequiredPiwik = "master";
+} else {
+    if (!preg_match("/^[^0-9]*(.*)/", $minimumRequiredPiwik, $matches)
+        || empty($matches[1])
+    ) {
+        $minimumRequiredPiwik = "master";
+    } else {
+        $minimumRequiredPiwik = $matches[1];
+    }
+}
+
+echo $minimumRequiredPiwik;
\ No newline at end of file