        (is (= "1" (:CMR-Hits headers))))))
 
 (deftest autocomplete-functionality-test
-  (testing "partial value match search"
-   (let [response (search/get-autocomplete-suggestions "q=f")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 1 (count (:entry (:feed data)))))))
+  (testing "value search"
+   (are3
+    [query expected]
+    (is (= expected (count (response-body->entries (query->json-response-body query)))))
 
-  (testing "full value match search"
-   (let [response (search/get-autocomplete-suggestions "q=foo")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 1 (count (:entry (:feed data)))))))
+    "partial value"
+    "q=f" 1
 
-  (testing "full value with extra value match search"
-   (let [response (search/get-autocomplete-suggestions "q=foos")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 0 (count (:entry (:feed data)))))))
+    "full value match"
+    "q=foo" 1
 
-  (testing "case sensitivity test"
-   (let [response (search/get-autocomplete-suggestions "q=FOO")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 1 (count (:entry (:feed data)))))))
+    "full value with extra value match"
+    "q=foos" 0
 
-  (testing "bad value search with no results"
-   (let [response (search/get-autocomplete-suggestions "q=zee")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 0 (count (:entry (:feed data)))))))
+    "case sensitivity test"
+    "q=FOO" 1
 
-  (testing "search with type filter"
-   (let [response (search/get-autocomplete-suggestions "q=foo&type[]=instrument")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 1 (count (:entry (:feed data)))))))
+    "no result test"
+    "q=zee" 0
 
-  (testing "search with multiple types filter"
-   (let [response (search/get-autocomplete-suggestions
-                    "q=b&type[]=instrument&type[]=platform&type[]=project&type[]=provider")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 2 (count (:entry (:feed data)))))))
+    "search with type filter"
+    "q=foo&type[]=instrument" 1
 
-  (testing "search with type filter with no results"
-   (let [response (search/get-autocomplete-suggestions "q=foo&type[]=platform")
-         body (:body response)
-         data (json/parse-string body true)]
-     (is (= 0 (count (:entry (:feed data))))))))
+    "search with multiple types filter"
+    "q=b&type[]=instrument&type[]=platform&type[]=project&type[]=provider" 2
+
+    "search with type filter with no results"
+    "q=foo&type[]=platform" 0)))
 
 (deftest autocomplete-usage-test
-  (testing "missing query param response test"
-   (let [response (search/get-autocomplete-suggestions nil {:throw-exceptions false})]
-     (is (= 400 (:status response)))))
+  (testing "invalid or missing query param tests"
+   (are3
+    [query]
+    (is (= 400 (:status (search/get-autocomplete-suggestions query {:throw-exceptions false}))))
 
-  (testing "empty string query response test"
-   (let [response (search/get-autocomplete-suggestions "q=  " {:throw-exceptions false})]
-     (is (= 400 (:status response)))))
+    "no query param provided"
+    nil
 
-  (testing "page_size 0 test"
-   (let [response (search/get-autocomplete-suggestions "q=*&page_size=0")
-         headers (:headers response)
-         body (json/parse-string (:body response) true)
-         entry (:entry (:feed body))]
-     (is (= "3" (:CMR-Hits headers)))
-     (is (= 0 (count entry)))))
+    "blank query provided"
+    "q=  "))
 
-  (testing "page_size 2 test"
-   (let [response (search/get-autocomplete-suggestions "q=*&page_size=2")
-         headers (:headers response)
-         body (json/parse-string (:body response) true)
-         entry (:entry (:feed body))]
-     (is (= "3" (:CMR-Hits headers)))
-     (is (= 2 (count entry)))))
+  (testing "page_size test"
+   (are3
+    [query expected cmr-hits]
+    (do
+      (let [response (search/get-autocomplete-suggestions query)
+            headers (:headers response)
+            body (json/parse-string (:body response) true)
+            entry (:entry (:feed body))]
+        (is (= (str cmr-hits) (:CMR-Hits headers)))
+        (is (= expected (count entry)))))
+
+    "page size 0"
+    "q=*&page_size=0" 0 3
+
+    "page size 1"
+    "q=*&page_size=1" 1 3
+
+    "page size 2"
+    "q=*&page_size=2" 2 3
+
+    "page size 3"
+    "q=*&page_size=3" 3 3
+
+    "page size 100"
+    "q=*&page_size=100" 3 3))
 
   (testing "page_num should yield different 'first' results test"
-   (let [page-one-response (search/get-autocomplete-suggestions "q=b&page_size=1")
-         page-one-headers  (:headers page-one-response)
-         page-one-body     (json/parse-string (:body page-one-response) true)
-         page-one-entry    (first (:entry (:feed page-one-body)))
+   (let [page-one-entry (as-> (query->json-response-body "q=b&page_size=1") response
+                              (first (response-body->entries response)))
 
-         page-two-response (search/get-autocomplete-suggestions "q=b&page_size=1&page_num=1")
-         page-two-headers  (:headers page-two-response)
-         page-two-body     (json/parse-string (:body page-two-response) true)
-         page-two-entry    (first (:entry (:feed page-two-body)))]
+         page-two-entry (as-> (query->json-response-body "q=b&page_size=1&page_num=1") response
+                              (first (response-body->entries response)))]
      (is (not (= page-one-entry page-two-entry))))))

    [cheshire.core :as json]
    [clojurewerkz.elastisch.rest :as esr]
    [clojurewerkz.elastisch.rest.document :as esd]
    [cmr.system-int-test.utils.url-helper :as url]
    [cmr.system-int-test.utils.ingest-util :as ingest]
    [cmr.system-int-test.utils.index-util :as index]

                     [(ingest/reset-fixture)
                      autocomplete-fixture]))

(defn- query->json-response-body
  ([query]
   (query->json-response-body query nil))
  ([query opts]
  (let [response (search/get-autocomplete-suggestions query opts)
        body (:body response)
        data (json/parse-string body true)]
    data)))

(defn- response-body->entries
  [data]
  (:entry (:feed data)))

(deftest autocomplete-response-test
  (testing "response form test"
     (let [response (search/get-autocomplete-suggestions "q=foo")
