diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php b/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php
index 571b663067151db4eb05d1484f38e1e10cd9527e..c32078c4cdbf2560039b210023f5df53b0a4c7c3 100644
--- a/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php
+++ b/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php
@@ -3,6 +3,7 @@
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
+
 namespace Magento\TestFramework\Utility;
 
 use Magento\Framework\App\Utility\Files;
@@ -15,6 +16,11 @@ use Magento\TestFramework\Utility\File\RegexIteratorFactory;
  */
 class ChangedFiles
 {
+    /**
+     * File path with changed files content.
+     */
+    const CHANGED_FILES_CONTENT_FILE = '/dev/tests/static/testsuite/Magento/Test/_files/changed_%s_files_content.json';
+
     /**
      * Returns array of PHP-files, that use or declare Magento application classes and Magento libs
      *
@@ -45,4 +51,32 @@ class ChangedFiles
 
         return $phpFiles;
     }
+
+    /**
+     * Get changed content.
+     *
+     * @param string $fileName
+     * @return string|null
+     */
+    public static function getChangedContent($fileName)
+    {
+        $extension = self::getFileExtension($fileName);
+        $fileName = ltrim(str_replace(BP, '', $fileName), DIRECTORY_SEPARATOR);
+        $changedContent = file_get_contents(BP . sprintf(self::CHANGED_FILES_CONTENT_FILE, $extension));
+        $data = json_decode($changedContent, true);
+
+        return isset($data[$fileName]) ? $data[$fileName] : [];
+    }
+
+    /**
+     * Get file extension.
+     *
+     * @param string $fileName
+     * @return string
+     */
+    public static function getFileExtension($fileName)
+    {
+        $fileInfo = pathinfo($fileName);
+        return isset($fileInfo['extension']) ? $fileInfo['extension'] : 'unknown';
+    }
 }
diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/FunctionDetector.php b/dev/tests/static/framework/Magento/TestFramework/Utility/FunctionDetector.php
index 17310404e372097169f7cc36dcd8bb125349565d..308b34855a3e44ec0df2143f26553b192ad8eef5 100644
--- a/dev/tests/static/framework/Magento/TestFramework/Utility/FunctionDetector.php
+++ b/dev/tests/static/framework/Magento/TestFramework/Utility/FunctionDetector.php
@@ -35,16 +35,20 @@ class FunctionDetector
     {
         $result = [];
         $regexp = $this->composeRegexp($functions);
+
         if ($regexp) {
+            $fileContent = \Magento\TestFramework\Utility\ChangedFiles::getChangedContent($filePath);
+            $matches = preg_grep($regexp, explode("\n", $fileContent));
             $file = file($filePath);
-            array_unshift($file, '');
-            $lines = preg_grep(
-                $regexp,
-                $file
-            );
-            foreach ($lines as $lineNumber => $line) {
-                if (preg_match_all($regexp, $line, $matches)) {
-                    $result[$lineNumber] = $matches[1];
+            if (!empty($matches)) {
+                foreach ($matches as $line) {
+                    $actualFunctions = [];
+                    foreach ($functions as $function) {
+                        if (false !== strpos($line, $function)) {
+                            $actualFunctions[] = $function;
+                        }
+                    }
+                    $result[array_search($line . "\n", $file) + 1] = $actualFunctions;
                 }
             }
         }
diff --git a/dev/tests/static/get_github_changes.php b/dev/tests/static/get_github_changes.php
index f332208cd17d0861dd1b28bd7096a0b3fe0066a5..7e57a13552de1de97be4849f5127dd46df57ed4d 100644
--- a/dev/tests/static/get_github_changes.php
+++ b/dev/tests/static/get_github_changes.php
@@ -34,6 +34,8 @@ if (!validateInput($options, $requiredOptions)) {
 
 $fileExtensions = explode(',', isset($options['file-extensions']) ? $options['file-extensions'] : 'php');
 
+include_once __DIR__ . '/framework/autoload.php';
+
 $mainline = 'mainline_' . (string)rand(0, 9999);
 $repo = getRepo($options, $mainline);
 $branches = $repo->getBranches('--remotes');
@@ -41,8 +43,23 @@ generateBranchesList($options['output-file'], $branches, $options['branch']);
 $changes = retrieveChangesAcrossForks($mainline, $repo, $options['branch']);
 $changedFiles = getChangedFiles($changes, $fileExtensions);
 generateChangedFilesList($options['output-file'], $changedFiles);
+saveChangedFileContent($repo);
 cleanup($repo, $mainline);
 
+/**
+ * Save changed file content.
+ *
+ * @param GitRepo $repo
+ * @return void
+ */
+function saveChangedFileContent(GitRepo $repo)
+{
+    $changedFilesContentFileName = BP . Magento\TestFramework\Utility\ChangedFiles::CHANGED_FILES_CONTENT_FILE;
+    foreach ($repo->getChangedContentFiles() as $key => $changedContentFile) {
+        file_put_contents(sprintf($changedFilesContentFileName, $key), json_encode($changedContentFile), FILE_APPEND);
+    }
+}
+
 /**
  * Generates a file containing changed files
  *
@@ -170,6 +187,18 @@ class GitRepo
      */
     private $remoteList = [];
 
+    /**
+     * Array of changed content files.
+     *
+     * Example:
+     *         'extension' =>
+     *                      'path_to_file/filename'  => 'Content that was edited',
+     *                      'path_to_file/filename2' => 'Content that was edited',
+     *
+     * @var array
+     */
+    private $changedContentFiles = [];
+
     /**
      * @param string $workTree absolute path to git project
      */
@@ -285,6 +314,9 @@ class GitRepo
                                 'diff HEAD %s/%s -- %s', $remoteAlias, $remoteBranch, $this->workTree . '/' . $fileName)
                         );
                         if ($result) {
+                            if (!(isset($this->changedContentFiles[$fileName]))) {
+                                $this->setChangedContentFile($result, $fileName);
+                            }
                             $filteredChanges[] = $fileName;
                         }
                     }
@@ -295,6 +327,38 @@ class GitRepo
         return $filteredChanges;
     }
 
+    /**
+     * Set changed content for file.
+     *
+     * @param array $content
+     * @param string $fileName
+     * @return void
+     */
+    private function setChangedContentFile(array $content, $fileName)
+    {
+        $changedContent = '';
+        $extension = Magento\TestFramework\Utility\ChangedFiles::getFileExtension($fileName);
+
+        foreach ($content as $item) {
+            if (strpos($item, '---') !== 0 && strpos($item, '-') === 0 && $line = ltrim($item, '-')) {
+                $changedContent .= $line . "\n";
+            }
+        }
+        if ($changedContent !== '') {
+            $this->changedContentFiles[$extension][$fileName] = $changedContent;
+        }
+    }
+
+    /**
+     * Get changed content files collection.
+     *
+     * @return array
+     */
+    public function getChangedContentFiles()
+    {
+        return $this->changedContentFiles;
+    }
+
     /**
      * Makes call ro git cli
      *