TAS-437 added TestRail annotation

This commit is contained in:
cnechifor
2016-09-09 15:55:29 +03:00
parent cee81cb837
commit 56493284dc
3 changed files with 58 additions and 52 deletions

View File

@@ -6,11 +6,14 @@ import org.alfresco.rest.model.RestCommentModel;
import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test(groups = { "rest-api", "comments", "sanity" })
public class SampleCommentsTest extends RestTest public class SampleCommentsTest extends RestTest
{ {
@Autowired @Autowired
@@ -29,37 +32,33 @@ public class SampleCommentsTest extends RestTest
restClient.authenticateUser(userModel); restClient.authenticateUser(userModel);
commentsAPI.useRestClient(restClient); commentsAPI.useRestClient(restClient);
document = dataContent.usingResource("Shared") document = dataContent.usingResource("Shared").usingUser(userModel).createContent(DocumentType.TEXT_PLAIN);
.usingUser(userModel)
.createContent(DocumentType.TEXT_PLAIN);
} }
@Test @TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToAddComment() throws JsonToModelConversionException, Exception public void admiShouldAddComment() throws JsonToModelConversionException, Exception
{ {
commentsAPI.addComment(document.getNodeRef(), "This is a new comment"); commentsAPI.addComment(document.getNodeRef(), "This is a new comment");
commentsAPI.usingRestWrapper() commentsAPI.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.CREATED.toString()); .assertStatusCodeIs(HttpStatus.CREATED.toString());
} }
@Test @TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToRetrieveComments() throws JsonToModelConversionException public void admiShouldRetrieveComments() throws JsonToModelConversionException
{ {
commentsAPI.getNodeComments(document.getNodeRef()); commentsAPI.getNodeComments(document.getNodeRef());
commentsAPI.usingRestWrapper() commentsAPI.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.OK.toString()); .assertStatusCodeIs(HttpStatus.OK.toString());
} }
@Test @TestRail(section={"rest-api", "comments"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToUpdateComment() throws JsonToModelConversionException, Exception public void adminShouldUpdateComment() throws JsonToModelConversionException, Exception
{ {
// add initial comment // add initial comment
String commentId = commentsAPI.addComment(document.getNodeRef(), "This is a new comment").getId(); String commentId = commentsAPI.addComment(document.getNodeRef(), "This is a new comment").getId();
// update comment // update comment
RestCommentModel commentEntry = commentsAPI.updateComment(document.getNodeRef(), RestCommentModel commentEntry = commentsAPI.updateComment(document.getNodeRef(), commentId, "This is the updated comment");
commentId,
"This is the updated comment");
commentEntry.assertCommentContentIs("This is the updated comment"); commentEntry.assertCommentContentIs("This is the updated comment");
} }

View File

@@ -3,12 +3,15 @@ package org.alfresco.rest;
import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.exception.DataPreparationException;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test(groups = { "rest-api", "people", "sanity" })
public class SamplePeopleTest extends RestTest public class SamplePeopleTest extends RestTest
{ {
@Autowired @Autowired
@@ -29,21 +32,21 @@ public class SamplePeopleTest extends RestTest
peopleAPI.useRestClient(restClient); peopleAPI.useRestClient(restClient);
} }
@Test @TestRail(section={"rest-api", "people"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToRetrievePerson() throws Exception public void adminShouldRetrievePerson() throws Exception
{ {
peopleAPI.getPerson(userModel.getUsername()) peopleAPI.getPerson(userModel.getUsername())
.assertResponseIsNotEmpty(); .assertResponseIsNotEmpty();
peopleAPI.usingRestWrapper() peopleAPI.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.OK.toString()); .assertStatusCodeIs(HttpStatus.OK.toString());
} }
@Test @TestRail(section={"rest-api", "people"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToRetrieveItself() throws Exception public void adminShouldRetrieveItself() throws Exception
{ {
peopleAPI.getPerson(adminUser.getUsername()) peopleAPI.getPerson(adminUser.getUsername())
.assertPersonHasName(adminUser.getUsername()); .assertPersonHasName(adminUser.getUsername());
} }
} }

View File

@@ -7,12 +7,15 @@ import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.exception.DataPreparationException; import org.alfresco.utility.exception.DataPreparationException;
import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.social.alfresco.api.entities.Role; import org.springframework.social.alfresco.api.entities.Role;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test(groups = { "rest-api", "people", "sanity" })
public class SampleSitesTest extends RestTest public class SampleSitesTest extends RestTest
{ {
@Autowired @Autowired
@@ -36,68 +39,69 @@ public class SampleSitesTest extends RestTest
siteAPI.useRestClient(restClient); siteAPI.useRestClient(restClient);
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminCanGetSiteDetails() throws JsonToModelConversionException, Exception public void adminShouldGetSiteDetails() throws JsonToModelConversionException, Exception
{ {
siteAPI.getSite(siteModel.getId()).assertResponseIsNotEmpty(); siteAPI.getSite(siteModel.getId())
.assertResponseIsNotEmpty();
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminCanAccessSiteDetails() throws JsonToModelConversionException, Exception public void adminShouldGetSites() throws JsonToModelConversionException, Exception
{ {
siteAPI.getSite(siteModel.getId()); siteAPI.getSite(siteModel.getId());
siteAPI.usingRestWrapper() siteAPI.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.OK.toString()); .assertStatusCodeIs(HttpStatus.OK.toString());
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminCanAccessSites() throws JsonToModelConversionException, Exception public void adminShouldAccessSites() throws JsonToModelConversionException, Exception
{ {
siteAPI.getSites() siteAPI.getSites()
.assertThatResponseIsNotEmpty(); .assertThatResponseIsNotEmpty();
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToRetrieveSites() throws JsonToModelConversionException, Exception public void adminShouldRetrieveSites() throws JsonToModelConversionException, Exception
{ {
siteAPI.getSites(); siteAPI.getSites();
siteAPI.usingRestWrapper() siteAPI.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.OK.toString()); .assertStatusCodeIs(HttpStatus.OK.toString());
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToAccessResponsePagination() throws JsonToModelConversionException, Exception public void adminShouldAccessResponsePagination() throws JsonToModelConversionException, Exception
{ {
siteAPI.getSites().assertResponseHasPagination(); siteAPI.getSites()
.assertResponseHasPagination();
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToAddNewSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception public void adminShouldAddNewSiteMember() throws JsonToModelConversionException, DataPreparationException, Exception
{ {
UserModel newMember = dataUser.createRandomTestUser(); UserModel newMember = dataUser.createRandomTestUser();
SiteMember siteMember = new SiteMember(Role.SiteCollaborator.toString(), SiteMember siteMember = new SiteMember(Role.SiteCollaborator.toString(), newMember.getUsername());
newMember.getUsername());
siteAPI.addPerson(siteModel.getId(), siteMember); siteAPI.addPerson(siteModel.getId(), siteMember);
siteAPI.usingRestWrapper() siteAPI.usingRestWrapper()
.assertStatusCodeIs(HttpStatus.CREATED.toString()); .assertStatusCodeIs(HttpStatus.CREATED.toString());
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToGetSiteFromSitesList() throws JsonToModelConversionException, Exception public void adminShouldGetSiteFromSitesList() throws JsonToModelConversionException, Exception
{ {
siteAPI.getAllSites() siteAPI.getAllSites()
.assertThatResponseHasSite(siteModel.getId()); .assertThatResponseHasSite(siteModel.getId());
} }
@Test @TestRail(section={"rest-api", "sites"}, executionType= ExecutionType.SANITY)
public void adminIsAbleToAccessSiteDetails() throws JsonToModelConversionException, Exception public void adminShouldAccessSiteDetails1() throws JsonToModelConversionException, Exception
{ {
siteAPI.getSite(siteModel.getId()) siteAPI.getSite(siteModel.getId())
.assertResponseIsNotEmpty() .assertResponseIsNotEmpty()
.assertSiteHasDescription(siteModel.getDescription()) .assertSiteHasDescription(siteModel.getDescription())
.assertSiteHasTitle(siteModel.getTitle()) .assertSiteHasTitle(siteModel.getTitle())
.assertSiteHasVisibility(siteModel.getVisibility()); .assertSiteHasVisibility(siteModel.getVisibility());
} }
} }