diff --git a/tests/phpunit/CRM/Mailing/BAO/QueryTest.php b/tests/phpunit/CRM/Mailing/BAO/QueryTest.php
index dad254c4d887cab95ec7845a5b45d4603c3bb152..13efbd49fa9c85cae3b3ff25b04734639769e891 100644
--- a/tests/phpunit/CRM/Mailing/BAO/QueryTest.php
+++ b/tests/phpunit/CRM/Mailing/BAO/QueryTest.php
@@ -53,6 +53,10 @@ class CRM_Mailing_BAO_QueryTest extends CiviUnitTestCase {
 
     $params = CRM_Contact_BAO_Query::convertFormValues($fv);
     $obj    = new CRM_Contact_BAO_Query($params);
+
+    // let's set useGroupBy=true, to prevent duplicate records
+    $obj->_useGroupBy = TRUE;
+
     $dao    = $obj->searchQuery();
 
     $contacts = array();