Search-1703: Simplified hierarchy and data prep methods for search tests

This should reduce the dataprep time for some tests and overall build duration
This commit is contained in:
Meenal Bhave
2019-06-27 14:15:52 +01:00
parent 7606dc9759
commit 695f4eb5f1
24 changed files with 66 additions and 39 deletions
@@ -43,4 +43,6 @@ public @interface TestGroup
public static final String ACS_52n = "ACS_52n"; // Alfresco Content Services 5.2.n
public static final String ACS_60n = "ACS_60n"; // Alfresco Content Services 6.0 or above
public static final String ACS_61n = "ACS_61n"; // Alfresco Content Services 6.1 or above
public static final String ACS_611n = "ACS_611n"; // Alfresco Content Services 6.1.1 or above
public static final String ACS_62n = "ACS_62n"; // Alfresco Content Services 6.2 or above
}
@@ -98,7 +98,7 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont
}
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
public void setup() throws Exception
{
serverHealth.assertServerIsOnline();
@@ -4,7 +4,7 @@ import java.lang.reflect.Method;
import org.alfresco.cmis.CmisProperties;
import org.alfresco.cmis.CmisWrapper;
import org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest;
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.alfresco.utility.Utility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,7 +23,7 @@ import org.testng.annotations.BeforeMethod;
@ContextConfiguration("classpath:alfresco-search-e2e-context.xml")
@Component
@Scope(value = "prototype")
public abstract class AbstractCmisE2ETest extends AbstractSearchServicesE2ETest
public abstract class AbstractCmisE2ETest extends AbstractE2EFunctionalTest
{
private static Logger LOGGER = LoggerFactory.getLogger(AbstractCmisE2ETest.class);
@@ -18,8 +18,7 @@ public class SolrSearchByAspectTests extends AbstractCmisE2ETest
private String siteDoclibNodeRef;
@BeforeClass(alwaysRun = true)
@Override
public void searchServicesDataPreparation() throws Exception
public void dataPreparation() throws Exception
{
dataContent.usingAdmin().deployContentModel("model/tas-model.xml");
@@ -18,8 +18,7 @@ public class SolrSearchByIdTests extends AbstractCmisE2ETest
private String siteDoclibNodeRef;
@BeforeClass(alwaysRun = true)
@Override
public void searchServicesDataPreparation() throws Exception
public void dataPreparation() throws Exception
{
dataContent.usingAdmin().deployContentModel("model/tas-model.xml");
@@ -17,8 +17,7 @@ public class SolrSearchByPropertyTests extends AbstractCmisE2ETest
private FileModel guestc, restc, tesc, testtttc, testc, testc1, testc2, testc3;
@BeforeClass(alwaysRun = true)
@Override
public void searchServicesDataPreparation() throws Exception
public void dataPreparation() throws Exception
{
dataContent.usingAdmin().deployContentModel("model/tas-model.xml");
@@ -37,21 +37,12 @@ public class SolrSearchScoreQueryTests extends AbstractCmisE2ETest
}
}
/* These tests does not require AbstractSearchServicesE2ETest common tests,
* as it's focused on testing scoring function features
* @see org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest#searchServicesDataPreparation()
*/
@Override
public void searchServicesDataPreparation() throws Exception
{
}
/* These tests does not require common data preparation from AbstractE2EFunctionalTest
* as it's including every test data required in search-score-funtion.xml
* @see org.alfresco.test.search.functional.AbstractE2EFunctionalTest#dataPreparation()
*/
@Override
public void dataPreparation() throws Exception
public void setup() throws Exception
{
}
@@ -18,7 +18,6 @@ import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
import org.alfresco.utility.model.FolderModel;
import org.testng.annotations.BeforeClass;
/**
* Abstract Search test class that contains useful methods
@@ -34,9 +33,8 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona
{
private static final String SEARCH_DATA_SAMPLE_FOLDER = "FolderSearch";
protected FileModel file, file2, file4;
protected FileModel file, file2, file3, file4;
@BeforeClass(alwaysRun = true)
public void searchServicesDataPreparation() throws Exception
{
/*
@@ -61,7 +59,7 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona
file2 = new FileModel("cars.txt", "cars" + title, description, FileType.TEXT_PLAIN,
"The landrover discovery is not a sports car ");
FileModel file3 = new FileModel("alfresco.txt", "alfresco", "alfresco", FileType.TEXT_PLAIN,
file3 = new FileModel("alfresco.txt", "alfresco", "alfresco", FileType.TEXT_PLAIN,
"Alfresco text file for search ");
file4 = new FileModel(unique_searchString + ".txt", "uniquee" + title, description, FileType.TEXT_PLAIN,
@@ -33,6 +33,7 @@ import org.alfresco.rest.search.RestResultBucketsModel;
import org.alfresco.rest.search.SearchRequest;
import org.alfresco.rest.search.SearchResponse;
import org.alfresco.search.TestGroup;
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
@@ -48,14 +49,14 @@ import org.testng.annotations.Test;
* @author Meenal Bhave
*
*/
public class FacetFieldsSearchTest extends AbstractSearchServicesE2ETest
public class FacetFieldsSearchTest extends AbstractE2EFunctionalTest
{
private UserModel userWithNoAccess, userCanAccessTextFile;
private SiteModel testSite;
private String fname;
@BeforeClass(alwaysRun = true)
public void setupEnvironment() throws Exception
public void dataPreparation() throws Exception
{
serverHealth.assertServerIsOnline();
@@ -44,8 +44,9 @@ import java.util.Collections;
public class FacetIntervalSearchTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void setupEnvironment() throws Exception
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
waitForContentIndexing(file4.getContent(), true);
}
@@ -38,6 +38,7 @@ import org.alfresco.search.TestGroup;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@@ -70,6 +71,13 @@ import org.testng.annotations.Test;
*/
public class FacetRangeSearchTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
waitForContentIndexing(file4.getContent(), true);
}
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
@TestRail(section = {TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 }, executionType = ExecutionType.REGRESSION,
description = "Check facet intervals mandatory fields")
@@ -96,8 +96,9 @@ public class FacetedSearchTest extends AbstractSearchServicesE2ETest
* }}
*/
@BeforeClass(alwaysRun = true)
public void setupEnvironment() throws Exception
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
waitForContentIndexing(file4.getContent(), true);
}
@@ -24,6 +24,7 @@ import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.search.TestGroup;
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.alfresco.utility.report.Bug;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
@@ -36,14 +37,14 @@ import static org.testng.Assert.assertTrue;
*
* @author Michael Suzuki
*/
public class FingerPrintTest extends AbstractSearchServicesE2ETest
public class FingerPrintTest extends AbstractE2EFunctionalTest
{
private FileModel file1;
private FileModel file2;
private FolderModel folder;
@BeforeClass(alwaysRun = true)
public void indexSimilarFile() throws Exception
public void dataPreparation() throws Exception
{
/*
* Create the following file structure in the same Site : In addition to the preconditions created in dataPreparation
@@ -51,8 +51,9 @@ import org.testng.annotations.Test;
public class PivotFacetedSearchTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void setupEnvironment() throws Exception
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
waitForContentIndexing(file4.getContent(), true);
}
@@ -31,6 +31,7 @@ import org.alfresco.rest.search.SearchRequest;
import org.alfresco.rest.search.SearchResponse;
import org.alfresco.search.TestGroup;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@@ -46,6 +47,12 @@ import org.testng.annotations.Test;
*/
public class SearchAPATHTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
waitForContentIndexing(file4.getContent(), true);
}
/**
* {
@@ -24,6 +24,7 @@ import org.alfresco.rest.search.RestRequestQueryModel;
import org.alfresco.rest.search.SearchResponse;
import org.alfresco.search.TestGroup;
import org.alfresco.utility.report.Bug;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@@ -33,6 +34,12 @@ import org.testng.annotations.Test;
*/
public class SearchHighLightTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
}
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API })
@Bug(id = "TAS-3220")
public void searchWithHighLight() throws Exception
@@ -26,6 +26,7 @@ import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
import org.alfresco.search.TestGroup;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@@ -36,6 +37,12 @@ import org.testng.annotations.Test;
*/
public class SearchSpellCheckTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
}
/**
* Perform the below query
* {
@@ -57,8 +57,9 @@ import org.testng.annotations.Test;
public class SearchTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void setupEnvironment() throws Exception
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
waitForContentIndexing(file4.getContent(), true);
}
@@ -43,7 +43,7 @@ public class SearchWithCustomModelTest extends AbstractE2EFunctionalTest
protected DataContent dataContent;
@BeforeClass(alwaysRun = true)
public void setupEnvironment() throws Exception
public void dataPreparation() throws Exception
{
serverHealth.assertServerIsOnline();
@@ -29,6 +29,7 @@ import org.alfresco.rest.search.RestShardInfoModel;
import org.alfresco.rest.search.RestShardInfoModelCollection;
import org.alfresco.rest.search.RestShardModel;
import org.alfresco.search.TestGroup;
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.springframework.http.HttpStatus;
/**
@@ -36,7 +37,7 @@ import org.springframework.http.HttpStatus;
*
* @author Tuna Aksoy
*/
public class ShardInfoTest extends AbstractSearchServicesE2ETest
public class ShardInfoTest extends AbstractE2EFunctionalTest
{
/* The test that will be excluded when running master slave setup, excluding the ASS_MASTER test group. */
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API, TestGroup.ACS_60n, TestGroup.ASS_MASTER })
@@ -58,8 +58,9 @@ import org.testng.annotations.Test;
public class StatsSearchTest extends AbstractSearchServicesE2ETest
{
@BeforeClass(alwaysRun = true)
public void setupEnvironment() throws Exception
public void dataPreparation() throws Exception
{
searchServicesDataPreparation();
waitForContentIndexing(file2.getContent(), true);
}
@@ -20,7 +20,7 @@ import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
import org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest;
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel;
@@ -34,7 +34,7 @@ import org.testng.annotations.BeforeClass;
*
* @author Cristina Diaconu
*/
public abstract class AbstractRmE2ETest extends AbstractSearchServicesE2ETest
public abstract class AbstractRmE2ETest extends AbstractE2EFunctionalTest
{
protected static final String FILE_PLAN_ALIAS = "-filePlan-";
protected static final String RECORD_TYPE = "rma:record";
@@ -10,6 +10,7 @@ package org.alfresco.test.search.functional.searchServices.search.rm;
import org.alfresco.rest.search.RestRequestQueryModel;
import org.alfresco.rest.search.SearchResponse;
import org.alfresco.search.TestGroup;
import org.alfresco.utility.model.FolderModel;
import org.springframework.http.HttpStatus;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -25,8 +26,9 @@ public class SearchServicesRME2ETest extends AbstractRmE2ETest
@Test(priority = 1, groups = { TestGroup.ASS_14 })
public void testBasicSearch() throws Exception
{
FolderModel testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
// Search for a folder name
String query = "select * from cmis:folder where cmis:name='" + FOLDER1 + "'";
String query = "select * from cmis:folder where cmis:name='" + testFolder + "'";
RestRequestQueryModel queryModel = new RestRequestQueryModel();
queryModel.setQuery(query);
@@ -20,7 +20,7 @@ import javax.json.JsonArrayBuilder;
import org.alfresco.rest.core.JsonBodyGenerator;
import org.alfresco.rest.model.RestTextResponse;
import org.alfresco.test.search.functional.searchServices.search.AbstractSearchServicesE2ETest;
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.alfresco.search.TestGroup;
import org.hamcrest.Matchers;
import org.springframework.http.HttpStatus;
@@ -32,7 +32,7 @@ import org.testng.annotations.Test;
*
* @author Meenal Bhave
*/
public class SearchSolrAPITest extends AbstractSearchServicesE2ETest
public class SearchSolrAPITest extends AbstractE2EFunctionalTest
{
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API, TestGroup.ASS_112 }, priority = 1)
public void testGetSolrConfig() throws Exception