diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
index bb371d8c48d7cb11a03e6267d08ef9bd25e9ca39..59160c7c309af64679bd705d5ba4d48a83befc62 100755
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ b/tests/PHPUnit/IntegrationTestCase.php
@@ -317,6 +317,10 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
         $path = static::getPathToTestDirectory();
         $processedPath = $path . '/processed/';
 
+        if (!is_dir($processedPath)) {
+            mkdir($processedPath, $mode = 0777, $recursive = true);
+        }
+
         if (!is_writable($processedPath)) {
             self::fail('To run the tests, you need to give write permissions to the following directory (create it if '
                       . 'it doesn\'t exist).<code><br/>mkdir ' . $processedPath . '<br/>chmod 777 ' . $processedPath
@@ -378,6 +382,24 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
         return $result;
     }
 
+    /**
+     * Assert that the response of an API method call is the same as the contents in an
+     * expected file.
+     *
+     * @param string $api ie, `"UserSettings.getBrowser"`
+     * @param array $queryParams Query parameters to send to the API.
+     */
+    public function assertApiResponseEqualsExpected($apiMethod, $queryParams)
+    {
+        $this->runApiTests($apiMethod, array(
+            'idSite' => $queryParams['idSite'],
+            'date' => $queryParams['date'],
+            'periods' => $queryParams['period'],
+            'testSuffix' => '_' . $this->getName(), // TODO: instead of using a test suffix, the whole file name should just be the test method
+            'otherRequestParameters' => $queryParams
+        ));
+    }
+
     /**
      * Runs API tests.
      */