Skip to content

Commit

Permalink
Merge pull request #68 from project-sunbird/functional-test
Browse files Browse the repository at this point in the history
#SB-4912 feat: Functional testcase
  • Loading branch information
bvinayakumar authored Aug 1, 2018
2 parents 47d8a79 + 837cf52 commit 09381b2
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,4 @@ public String getLmsApiUriPath(String apiGatewayUriPath, String localUriPath, St
? localUriPath + pathParam
: apiGatewayUriPath + pathParam;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public Object[][] createOrgFailureDataProvider() {
public void testCreateOrganisationFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getAuthToken(this, isAuthRequired);

getTestCase().setName(testName);
performPostTest(
this,
TEMPLATE_DIR,
Expand Down Expand Up @@ -111,6 +113,8 @@ public Object[][] createOrgSuccessDataProvider() {
public void testCreateOrganisationSuccess(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getAuthToken(this, isAuthRequired);

getTestCase().setName(testName);
variable("rootOrgChannel", OrgUtil.getRootOrgChannel());
performPostTest(
this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Object[][] readOrgFailureDataProvider() {
@CitrusParameters({"testName", "httpStatusCode"})
@CitrusTest
public void testReadOrganisationFailure(String testName, HttpStatus httpStatusCode) {

getTestCase().setName(testName);
performPostTest(
this,
TEMPLATE_DIR,
Expand All @@ -86,6 +86,7 @@ public Object[][] readOrgSuccessDataProvider() {
@CitrusTest
public void testReadOrganisationSuccess(String testName, HttpStatus httpStatusCode) {
variable("rootOrgExternalId", externalId);
getTestCase().setName(testName);
beforeTest();
performPostTest(
this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public Object[][] searchOrgFailureDataProvider() {
@CitrusParameters({"testName", "httpStatusCode"})
@CitrusTest
public void testSearchOrganisationFailure(String testName, HttpStatus httpStatusCode) {
getTestCase().setName(testName);
performPostTest(
this,
TEMPLATE_DIR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Object[][] assemblePageFailureDataProvider() {
@CitrusTest
public void testAssemblePageFailure(
String testName, HttpStatus httpStatusCode, boolean canCreatePage) {

getTestCase().setName(testName);
beforeTestAssemblePage(canCreatePage);
performPostTest(
this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void testCreatePageFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode, boolean canCreatePage) {
getAuthToken(this, isAuthRequired);
beforeTestCreatePage(testName, false, canCreatePage);

getTestCase().setName(testName);
performPostTest(
this,
TEMPLATE_DIR,
Expand Down Expand Up @@ -94,7 +94,7 @@ public void testCreatePageSuccess(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode, boolean canCreateOrg) {

getAuthToken(this, true);

getTestCase().setName(testName);
beforeTestCreatePage(testName, canCreateOrg, false);

performPostTest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Object[][] readAllPagesSettingsFailureDataProvider() {
@CitrusTest
public void testReadAllPagesSettingsFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {

getTestCase().setName(testName);
getAuthToken(this, isAuthRequired);

performGetTest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ public Object[][] readPageSettingsFailureDataProvider() {
new Object[] {
TEST_NAME_READ_PAGE_SETTINGS_FAILURE_WITHOUT_ACCESS_TOKEN, false, HttpStatus.UNAUTHORIZED,
},
new Object[] {
/*
* JIRA - SB-5674. Once fixed enable this line
*
* new Object[] {
TEST_NAME_READ_PAGE_SETTINGS_FAILURE_WITH_INVALID_PAGE_ID, true, HttpStatus.NOT_FOUND,
},
},*/
};
}

Expand All @@ -49,7 +52,7 @@ public Object[][] readPageSettingsFailureDataProvider() {
public void testReadPageSettingsFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getAuthToken(this, isAuthRequired);

getTestCase().setName(testName);
String url = getReadPageUrl("/invalid");

performGetTest(
Expand All @@ -73,6 +76,7 @@ public void testReadPageSettingsSuccess(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode, boolean canCreatePage) {

getAuthToken(this, isAuthRequired);
getTestCase().setName(testName);
beforeTestPageSettings(canCreatePage);
String url = getReadPageUrl("/" + PAGE_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ public Object[][] updatePageFailureDataProvider() {
@CitrusTest
public void testUpdatePageFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getTestCase().setName(testName);

getAuthToken(this, isAuthRequired);

performPatchTest(
this,
TEMPLATE_DIR,
Expand Down Expand Up @@ -79,7 +82,7 @@ public Object[][] updatePageSuccessDataProvider() {
@CitrusTest
public void testUpdatePageSuccess(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode, boolean canCreatePage) {

getTestCase().setName(testName);
getAuthToken(this, isAuthRequired);

beforeTestUpdatePage(canCreatePage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public Object[][] createPageSectionFailureDataProvider() {
public void testCreatePageSectionFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getAuthToken(this, isAuthRequired);
getTestCase().setName(testName);
performPostTest(
this,
TEMPLATE_DIR,
Expand All @@ -77,7 +78,7 @@ public Object[][] createPageSectionSuccessDataProvider() {
public void testCreatePageSectionSuccess(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getAuthToken(this, true);

getTestCase().setName(testName);
performPostTest(
this,
TEMPLATE_DIR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class ListPageSectionTest extends BaseCitrusTestRunner {
public static final String TEST_NAME_LIST_PAGE_SECTION_FAILURE_WITHOUT_ACCESS_TOKEN =
"testListPageSectionFailureWithoutAccessToken";

public static final String TEST_NAME_LIST_PAGE_SECTION_SUCCESS =
"testListPageSectionSuccess";
public static final String TEST_NAME_LIST_PAGE_SECTION_SUCCESS = "testListPageSectionSuccess";

public static final String TEMPLATE_DIR = "templates/page/read";

Expand All @@ -26,10 +25,10 @@ public Object[][] listPageSectionFailureDataProvider() {

return new Object[][] {
new Object[] {
TEST_NAME_LIST_PAGE_SECTION_FAILURE_WITHOUT_ACCESS_TOKEN, false, HttpStatus.UNAUTHORIZED
TEST_NAME_LIST_PAGE_SECTION_FAILURE_WITHOUT_ACCESS_TOKEN, false, HttpStatus.UNAUTHORIZED
},
new Object[] {
TEST_NAME_LIST_PAGE_SECTION_SUCCESS, true, HttpStatus.OK,
TEST_NAME_LIST_PAGE_SECTION_SUCCESS, true, HttpStatus.OK,
},
};
}
Expand All @@ -40,7 +39,7 @@ public Object[][] listPageSectionFailureDataProvider() {
public void testListPageSectionFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getAuthToken(this, isAuthRequired);

getTestCase().setName(testName);
performGetTest(
this,
TEMPLATE_DIR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ public Object[][] readPageSectionFailureDataProvider() {
HttpStatus.UNAUTHORIZED,
"/invalid"
},
new Object[] {
/*
* JIRA - SB-5675. Once fixed enable this line
*
* new Object[] {
TEST_NAME_READ_PAGE_SECTIONS_FAILURE_WITH_INVALID_ID, true, HttpStatus.NOT_FOUND, "/invalid"
},
},*/
};
}

Expand All @@ -43,7 +46,7 @@ public Object[][] readPageSectionFailureDataProvider() {
public void testReadPageSectionFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode, String pathParam) {
getAuthToken(this, isAuthRequired);

getTestCase().setName(testName);
performGetTest(
this,
TEMPLATE_DIR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public Object[][] updatePageSectionFailureDataProvider() {
public void testUpdatePageSectionFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getAuthToken(this, isAuthRequired);
getTestCase().setName(testName);
performPatchTest(
this,
TEMPLATE_DIR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.consol.citrus.testng.CitrusParameters;
import javax.ws.rs.core.MediaType;
import org.springframework.http.HttpStatus;
import org.sunbird.common.action.UserUtil;
import org.sunbird.integration.test.common.BaseCitrusTestRunner;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -65,5 +64,4 @@ public void testAddUserSkillFailure(
httpStatusCode,
RESPONSE_JSON);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void testReadUserSkillFailure(
String testName, boolean isAuthRequired, HttpStatus httpStatusCode) {
getTestCase().setName(testName);
getAuthToken(this, isAuthRequired);
getTestCase().setName(testName);
performPostTest(
this,
TEMPLATE_DIR,
Expand Down

0 comments on commit 09381b2

Please sign in to comment.