示例#1
0
        public void BTA146_REST_GetAccountSummaryByID_Positive()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";

            common = new Common(this.DriverContext);
            rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <String>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <String>("isError"));
                if (member.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("Member is added through PostMember service and following are the details, IPCODE:= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <String>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching Account Summary through rest service using IpCode";
                    JObject response = (JObject)rest_Service_Method.GetAccountSummaryByIpCode(member["data"].Value <int>("id") + "");
                    testStep.SetOutput("members current status and currency balance from reponse are \"" + response["data"].Value <string>("memberStatus") + "\" and \"" + response["data"].Value <int>("currencyBalance") + "\"");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                    Logger.Info("test passed");
                }
                else
                {
                    testStep.SetOutput(member.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  failed");
                    throw new Exception(member.Value <String>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
                Logger.Info("test  failed" + e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#2
0
        public void BTA1569_ST1607_REST_AuthToken_EN_AcceptLanguage()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Creating auth token through rest service where Accept Language is English";
                JObject token = (JObject)rest_Service_Method.PostAuthToken();
                var     k     = token.Values <string>("isError");
                Logger.Info(k.GetType());
                Logger.Info(token.Value <string>("isError"));

                if (token.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("Access Token =" + token["data"].Value <string>("accessToken") + " User Message=" + token.Value <string>("userMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    //testStep.SetOutput(token.Value<string>("userMessage"));
                    //testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    //listOfTestSteps.Add(testStep);
                    throw new Exception("Reponse code: " + token.Value <string>("responseCode") + " ;Error Response Code is NOT matching; Developer Error Message from response is: " + token.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#3
0
        public void BTA144_REST_PT_AddTransactionUsingInvalidVCKey_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Posting transaction to a member by providing Invalid VcKey";
                response = (JObject)rest_Service_Method.PostTransactionWithVCKeyWithRequiredFields(common.RandomNumber(12));
                if (response.Value <string>("responseCode") == "10508")
                {
                    testStep.SetOutput("The following are the error details when we add transaction using Invalid VCKEY:; Response Code: " + response.Value <string>("responseCode") + "; and corresponding DeveloperMessage: " + response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                    Logger.Info("The following are the error details when we add transaction using Invalid VCKEY: Response Code: " + response.Value <string>("responseCode") + " and corresponding DeveloperMessage: " + response.Value <string>("developerMessage"));
                    Logger.Info("Test Method Passed");
                }
                else
                {
                    testStep.SetOutput("Response Code=" + response.Value <string>("responseCode") + ", Message =" + response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(false);
                    Logger.Info("Test Method Failed");
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#4
0
        public void BTA1569_ST1655_REST_AuthToken_EN_ValidClientIdAndInValidSecretId()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching Auth Token for Valid clientId and Invalid ClinetSecret";
                response = (JObject)rest_Service_Method.PostAuthTokenReg(DatabaseUtility.GetExpectedColumValue(ProjectTestBase.TEST_DATA_FOR_AUTH_TOKEN, 1, "clientId"), DatabaseUtility.GetExpectedColumValue(ProjectTestBase.TEST_DATA_FOR_AUTH_TOKEN, 1, "clientSecret"));

                if (response.Value <Int32>("responseCode") == 11110)
                {
                    testStep.SetOutput("Response Code=" + response.Value <Int32>("responseCode") + ", Message =" + response.Value <String>("userMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    //testStep.SetOutput("Response Code=" + response.Value<Int32>("responseCode") + ", Message =" + response["errors"][0].Value<String>("errorMessage"));
                    //testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    //listOfTestSteps.Add(testStep);
                    //testCase.SetStatus(false);
                    throw new Exception("Reponse code: " + response.Value <string>("responseCode") + " ;Error Response Code is NOT matching; Developer Error Message from response is: " + response.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#5
0
        public void BTA1569_ST1662_REST_AuthToken_JA_WithoutProvidingClientIdAndSecretId()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching Auth Token without providing clientId and ClinetSecret where accept language is Japanese";
                response = (JObject)rest_Service_Method.PostAuthTokenRegWithoutBodyJa(null, null);
                if (response.Value <Int32>("responseCode") == 10400)
                {
                    testStep.SetOutput("Response Code=" + response.Value <Int32>("responseCode") + ", Message =" + response.Value <String>("userMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    //testStep.SetOutput("Response Code=" + response.Value<Int32>("responseCode") + ", Message =" + response["errors"][0].Value<String>("errorMessage"));
                    //testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    //listOfTestSteps.Add(testStep);
                    //testCase.SetStatus(false);
                    throw new Exception("Reponse code: " + response.Value <string>("responseCode") + " ;Error Response Code is NOT matching; Developer Error Message from response is: " + response.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#6
0
        public void BTA143_REST_GetMemberByID_Negative()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching member through rest service by providing Invalid IpCode";
                response = (JObject)rest_Service_Method.GetMemberDetailsByIpCode(common.RandomString(12));
                if (response.Value <Int32>("responseCode") == 10501)
                {
                    testStep.SetOutput("Response Code=" + response.Value <Int32>("responseCode") + ", Message =" + response["errors"][0].Value <String>("errorMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    testStep.SetOutput("Response Code=" + response.Value <Int32>("responseCode") + ", Message =" + response["errors"][0].Value <String>("errorMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(false);
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#7
0
        public void BTA87_REST_Auth_Token()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Getting Authentication Token";
                String authToken = rest_Service_Method.GetAuthToken();
                testStep.SetOutput(authToken);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);
                Logger.Info("test passed");
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#8
0
        public void BTA143_REST_GetMemberByID_Positive()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <String>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <String>("isError"));
                if (member.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE=" + member["data"].Value <int>("id") + ";Name=" + member["data"].Value <String>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member through rest service using IpCode";
                    JObject response = (JObject)rest_Service_Method.GetMemberDetailsByIpCode(member["data"].Value <int>("id") + "");
                    testStep.SetOutput("IPCODE=" + response["data"].Value <int>("id") + ";Name=" + response["data"].Value <String>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validating the response through assertions";
                    Assert.AreEqual(member["data"].Value <String>("firstName"), response["data"].Value <String>("firstName"), "Expected value is " + member["data"].Value <String>("firstName") + " and actual value is " + response["data"].Value <String>("firstName"));
                    Assert.AreEqual(member["data"]["cards"][0].Value <String>("cardNumber"), response["data"]["cards"][0].Value <String>("cardNumber"), "Expected value is " + member["data"]["cards"][0].Value <String>("cardNumber") + " and actual value is " + response["data"]["cards"][0].Value <String>("cardNumber"));
                    Assert.AreEqual(member["data"].Value <String>("username"), response["data"].Value <String>("username"), "Expected value is " + member["data"].Value <String>("username") + " and actual value is " + response["data"].Value <String>("username"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                    Logger.Info("test passed");
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(member.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(member.Value <String>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#9
0
        public void BTA555_REST_GetMemberRewardsByFMS_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <string>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <string>("isError"));
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using First Name";
                    JObject firstNameResponse = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.FirstName, member["data"].Value <string>("firstName") + "");
                    testStep.SetOutput("The member with IPCODE = " + firstNameResponse["data"][0].Value <int>("memberId") +
                                       " and; first name: " + member["data"].Value <string>("firstName") +
                                       " has the reward with; rewardID = " + firstNameResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using email";
                    JObject emailResponse = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.EmailAddress, member["data"].Value <string>("email") + "");
                    testStep.SetOutput("The member with IPCODE = " + emailResponse["data"][0].Value <int>("memberId") +
                                       " and; email: " + member["data"].Value <string>("email") +
                                       " has the reward with; rewardID = " + emailResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    string CardID = member["data"]["cards"][0].Value <string>("cardNumber");
                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using CARD ID";
                    JObject cardIDResponse = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.CardID, CardID);
                    testStep.SetOutput("The member with IPCODE = " + cardIDResponse["data"][0].Value <int>("memberId") +
                                       " and; CardID: " + CardID +
                                       " has the reward with; rewardID = " + cardIDResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validate the rewardid got from response in db";
                    string dbresponse = DatabaseUtility.GetRewardIDfromDBUsingIPCODEREST(firstNameResponse["data"][0].Value <int>("memberId") + "");
                    Assert.AreEqual(firstNameResponse["data"][0].Value <int>("rewardId") + "", dbresponse, "Expected value is " + firstNameResponse["data"][0].Value <int>("rewardId") + " and actual value is " + dbresponse);
                    testStep.SetOutput("RewardID returned from db is " + dbresponse + " which matches with the rewardID from the response: " + firstNameResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test passed");

                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(member.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#10
0
        public void BTA555_REST_GetMemberRewardsByFMS_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching member rewards through rest service using Invalid First Name";
                response = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.FirstName, common.RandomString(15));
                if (response.Value <string>("isError") == "True")
                {
                    testStep.SetOutput("The response code from GetMemberRewardsByFMS service for a member with " +
                                       "invalid First Name is: " + response.Value <int>("responseCode") + "");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validate the developer message for the above response code from the Service";
                    if (response.Value <int>("responseCode") == 10504)
                    {
                        testStep.SetOutput("developerMessage from response is: " + response.Value <string>("developerMessage"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        Logger.Info("test passed");
                        testCase.SetStatus(true);
                    }
                    else
                    {
                        Logger.Info("test failed");
                        testStep.SetOutput("response message is" + response.Value <string>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        throw new Exception("response message is" + response.Value <string>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                    }
                }
                else
                {
                    Logger.Info("test failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA556_REST_PatchRedeemMemberReward_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <string>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <string>("isError"));

                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using IpCode";
                    JObject response = (JObject)rest_Service_Method.GetMemberRewardsByIpCode(member["data"].Value <int>("id") + "");
                    testStep.SetOutput("The member with IPCODE = " + response["data"][0].Value <int>("memberId") + " has the reward with rewardID = " + response["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Redeeming member rewards through rest service using RewardID";
                    response = (JObject)rest_Service_Method.PatchRedeemMemberRewardByUsingRewardId(response["data"][0].Value <int>("id") + "");
                    testStep.SetOutput("The member with IPCODE = " + response["data"].Value <int>("memberId") + " has redeemed the reward with rewardID = " + response["data"].Value <int>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    Logger.Info("Test Method Started");
                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Redeeming an already redeemed memberreward using rewardID through rest service";
                    response = (JObject)rest_Service_Method.PatchRedeemMemberRewardByUsingRewardId(response["data"].Value <int>("id") + "");
                    if (response.Value <string>("isError") == "True")
                    {
                        testStep.SetOutput("The response code from PatchRedeemMemberReward service for an already redeemed memberreward " +
                                           "with RewardId is " + response.Value <int>("responseCode") + "");
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep);

                        testStep = TestStepHelper.StartTestStep(testStep);
                        stepName = "Validate the user message for the above response code from the Service";
                        if (response.Value <int>("responseCode") == 50102)
                        {
                            testStep.SetOutput("userMessage from response is: " + response.Value <string>("userMessage"));
                            testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                            listOfTestSteps.Add(testStep);
                            Logger.Info("test passed");
                            testCase.SetStatus(true);
                        }
                        else
                        {
                            Logger.Info("test failed");
                            testStep.SetOutput("response message is" + response.Value <string>("userMessage") + "and response code is" + response.Value <int>("responseCode"));
                            testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                            listOfTestSteps.Add(testStep);
                            throw new Exception("response message is" + response.Value <string>("userMessage") + "and response code is" + response.Value <int>("responseCode"));
                        }
                    }
                    else
                    {
                        Logger.Info("test failed");
                        testStep.SetOutput(response.Value <string>("userMessage"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        throw new Exception(response.Value <string>("userMessage"));
                    }
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#12
0
        public void BTA375_REST_PostMemberToTargetedPromotion_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding invalid promotion by providing the invalid firstName and promotionCode details";
                response = (JObject)rest_Service_Method.PostMemberToTargetedPromotion(common.RandomString(6), common.RandomString(4));
                if (response.Value <string>("isError") == "True")
                {
                    testStep.SetOutput("The response code if an invalid details (firstname, promotioncode) are passed is: " + response.Value <int>("responseCode") + "");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validating developer message for the response code 10504";
                    if (response.Value <int>("responseCode") == 10504)
                    {
                        testStep.SetOutput("Developer message from response code 10504 is \"" + response.Value <string>("developerMessage") + "\"");
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);

                        testCase.SetStatus(true);
                    }
                    else
                    {
                        Logger.Info("test failed");
                        testStep.SetOutput("Developer message is" + response.Value <string>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        throw new Exception("Developer message is" + response.Value <string>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                    }
                }
                else
                {
                    Logger.Info("test failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#13
0
        public void BTA502_REST_GetMemberPromotionWithoutPromotion_Negative()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <string>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <string>("isError"));
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("Member is added through PostMember service and following are the details, IPCODE:= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName"));;
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching and validating  member promotions through rest service by providing First Name as parameter for member without promotions";
                    response = (JObject)rest_Service_Method.GetMemberPromotions(member["data"].Value <string>("firstName"));
                    if (response.Value <string>("isError") == "False")
                    {
                        testStep.SetOutput("The response code from GetMemberPromotion service for a member with out promotion is: " + response.Value <int>("responseCode")
                                           + " and the message is: " + response.Value <string>("userMessage"));
                        Assert.AreEqual(53101, response.Value <int>("responseCode"), "Expected Value is 53101 and the actual value is" + response.Value <int>("responseCode"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        testCase.SetStatus(true);
                    }
                    else
                    {
                        Logger.Info("test failed");
                        testStep.SetOutput(response.Value <string>("developerMessage"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        throw new Exception(response.Value <string>("developerMessage"));
                    }
                }
                else
                {
                    Logger.Info("test failed");
                    testStep.SetOutput(member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(member.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#14
0
        public void BTA373_REST_GetRewardsInRewardDefinition()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String    stepName   = "";
            Common    common     = new Common(this.DriverContext);
            ArrayList RewardID   = new ArrayList();
            ArrayList RewardName = new ArrayList();
            string    RwdID      = string.Empty;
            string    RwdName    = string.Empty;

            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching all rewards from rewards definition through rest service ";
                JObject output = (JObject)rest_Service_Method.GetAllRewardsInRewardsDefinition();
                if (output.Value <string>("isError") == "False")
                {
                    JArray RewardIDItems = (JArray)output["data"];
                    foreach (JToken RewardIDItem in RewardIDItems)
                    {
                        RewardID.Add((string)RewardIDItem["id"]);
                        RewardName.Add((string)RewardIDItem["name"]);
                    }
                    RwdID   = string.Join(";", RewardID.ToArray());
                    RwdName = string.Join(";", RewardName.ToArray());

                    testStep.SetOutput("Total reward id's fetched by service are; " + RwdID + " ;and the resp Reward Name's are ;" + RwdName);
                    //testStep.SetOutput("First reward id: " + output["data"][0].Value<int>("id") + " and the Reward Name is: " + output["data"][0].Value<string>("name"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validating the data from database";
                    string dbresponse = DatabaseUtility.GetRewardNameUsingIDDBREST(output["data"][0].Value <int>("id") + "");
                    Assert.AreEqual(output["data"][0].Value <string>("name"), dbresponse, "Expected value is " + output["data"][0].Value <string>("name") + " and actual value is " + dbresponse);
                    testStep.SetOutput("Reward name from the database is  " + dbresponse + " for the rewardID: " + output["data"][0].Value <int>("id") + "");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  passed");

                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(output.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(output.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
                Logger.Info("test  failed" + e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA374_REST_PostMemberAttributeSet_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <String>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <String>("isError"));
                if (member.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("Member is added through PostMember service and following are the details, IPCODE:= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <String>("firstName"));;
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                }
                else
                {
                    testStep.SetOutput(member.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  failed");
                    throw new Exception(member.Value <String>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding attribute set through rest service by providing the member.firstName as parameter";
                response = (JObject)rest_Service_Method.PostMemberAttributeSets(member["data"].Value <String>("firstName"));
                if (response.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("Getting the ID for the \"memberDetails\" attribute set from the response:" + response["data"]["memberDetails"].Value <int>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep);

                    stepName = "Validating data with data from database";
                    String dbresponse = DatabaseUtility.GetMemberDetailsIdusingIpcodefromDBREST(member["data"].Value <int>("id") + "");
                    Assert.AreEqual(response["data"]["memberDetails"].Value <int>("id") + "", dbresponse, "Expected value is " + response["data"]["memberDetails"].Value <int>("id") + " and actual value is " + dbresponse);
                    testStep.SetOutput("The memberDetails ID for the attributeset added is \"" + response["data"]["memberDetails"].Value <int>("id") + "\" and the response from database for A_ROWKEY column in ats_memberdetails table is:" + dbresponse);
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test failed");
                    testStep.SetOutput(response.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <String>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA374_REST_PostMemberAttributeSet_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding attribute set by providing invalid member.firstName as parameter";
                response = (JObject)rest_Service_Method.PostMemberAttributeSets(common.RandomString(6));

                if (response.Value <String>("isError") == "True")
                {
                    testStep.SetOutput("when a invalid member name is passed for attributesets call, the response code from the reponse is : " + response.Value <int>("responseCode") + "");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validating developer message from the Service when response code is 10504";
                    if (response.Value <int>("responseCode") == 10504)
                    {
                        testStep.SetOutput("developer message from response is \"" + response.Value <string>("developerMessage") + "\" when response code is 10504");
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        testCase.SetStatus(true);
                    }
                    else
                    {
                        Logger.Info("test failed");
                        testStep.SetOutput("response message is" + response.Value <String>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        throw new Exception("response message is" + response.Value <String>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                    }
                }
                else
                {
                    Logger.Info("test failed");
                    testStep.SetOutput(response.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <String>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA556_REST_PatchRedeemMemberReward_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <string>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <string>("isError"));

                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using IpCode";
                    JObject response = (JObject)rest_Service_Method.GetMemberRewardsByIpCode(member["data"].Value <int>("id") + "");
                    testStep.SetOutput("The member with IPCODE = " + response["data"][0].Value <int>("memberId") + " has the reward with rewardID = " + response["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Redeeming member rewards through rest service using RewardID";
                    response = (JObject)rest_Service_Method.PatchRedeemMemberRewardByUsingRewardId(response["data"][0].Value <int>("id") + "");
                    testStep.SetOutput("The member with IPCODE = " + response["data"].Value <int>("memberId") + " has redeemed the reward with rewardID = " + response["data"].Value <int>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validate the redemptiondate got from response with DB";
                    string   dbresponse = DatabaseUtility.GetRedemptionDatefromDBUsingRewardIdREST(response["data"].Value <int>("id") + "");
                    DateTime datedb     = Convert.ToDateTime(dbresponse).Date;
                    DateTime resp       = Convert.ToDateTime(response["data"].Value <DateTime>("redemptionDate")).Date;
                    Assert.AreEqual(resp, datedb, "Expected value is " + resp + " and actual value is " + datedb);
                    testStep.SetOutput("Redemption Date returned from db is " + dbresponse + " which matches with the Redemption Date from the response: " + resp);
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test passed");

                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(member.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#18
0
        public void BTA372_REST_UpdateMember_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("Members details are IPCODE= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName") + "; and Email=" + member["data"]["cards"][0].Value <string>("email"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                }
                else
                {
                    testStep.SetOutput(member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    Logger.Info("test  failed");
                    listOfTestSteps.Add(testStep);
                    throw new Exception(member.Value <string>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Updating Member through REST Service";
                response = (JObject)rest_Service_Method.PatchUpdateMemberwithIpcode(member["data"].Value <int>("id") + "");
                if (response.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("The Member with IPcode: " + response["data"].Value <int>("id") + " email address has been updated to : \"" + response["data"].Value <string>("email") + "\" and city from member attribute details has been updated to: \"" + response["data"]["attributeSets"][0]["memberDetails"][0].Value <string>("city") + "\"");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);


                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validating data with data from database";
                    string dbresponse = DatabaseUtility.GetEmailfromDBUsingIpcodeREST(response["data"].Value <int>("id"));
                    Assert.AreEqual(response["data"].Value <string>("email"), dbresponse, "Expected value is " + response["data"].Value <string>("email") + " and actual value is " + dbresponse);
                    string dbresponse1 = DatabaseUtility.GetCityusingIPCODEREST(response["data"].Value <int>("id"));
                    Assert.AreEqual(dbresponse1, response["data"]["attributeSets"][0]["memberDetails"][0].Value <string>("city"), "Expected city name is" + dbresponse1 + " and the actual city name is" + response["data"]["attributeSets"][0]["memberDetails"][0].Value <string>("city"));
                    testStep.SetOutput("Updated EMAIL-ID  from database is: \"" + dbresponse + "\" and Updated city from DB is \"" + response["data"]["attributeSets"][0]["memberDetails"][0].Value <string>("city") + "\"");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  passed");

                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(response.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <String>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#19
0
        public void BTA144_REST_PT_AddTransactionToMember_WithAllFields_UsingVCKEY_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject       response;
            List <string> ats_txnheader = new List <string>();

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE=" + member["data"].Value <int>("id") + "; Name=" + member["data"].Value <string>("firstName") + "; VC_KEY=" + member["data"]["cards"][0].Value <string>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                }
                else
                {
                    testStep.SetOutput(member.Value <string>("responseCode") + member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info(member.Value <string>("responseCode") + member.Value <string>("developerMessage"));
                    Logger.Info("Test  failed");
                    throw new Exception(member.Value <string>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding transaction through rest service to a member with all fields by providing the VCKEY";
                response = (JObject)rest_Service_Method.PostTransactionWithVCKeyWithAllFields(member["data"]["cards"][0].Value <string>("id"));
                if (response.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("Transaction Rowkey: " + response["data"]["transactions"].Value <string>("id") + "; TransactionID: " + response["data"]["transactions"].Value <string>("transactionId") + "; TransactionAmount: " + response["data"]["transactions"].Value <string>("amount"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep      = TestStepHelper.StartTestStep(testStep);
                    stepName      = "Validate data from DB";
                    ats_txnheader = DatabaseUtility.GetVCkeyfromDBUsingROWKEYREST(response["data"]["transactions"].Value <string>("id"));
                    testStep.SetOutput("The Following details are verified in DB:" +
                                       "; VCKEY is: " + ats_txnheader[0] +
                                       "; TransactionID is: " + ats_txnheader[1] +
                                       "; Transaction Amt is: " + ats_txnheader[2]);
                    Assert.AreEqual(member["data"]["cards"][0].Value <string>("id"), ats_txnheader[0], "Expected value is " + member["data"]["cards"][0].Value <string>("id") + " and actual value is " + ats_txnheader[0]);
                    Assert.AreEqual(response["data"]["transactions"].Value <string>("transactionId"), ats_txnheader[1], "Expected value is " + response["data"]["transactions"].Value <string>("transactionId") + " and actual value is " + ats_txnheader[1]);
                    Assert.AreEqual(response["data"]["transactions"].Value <string>("amount"), ats_txnheader[2], "Expected value is " + response["data"]["transactions"].Value <string>("amount") + " and actual value is " + ats_txnheader[2]);
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#20
0
        public void BTA145_REST_GetMemberActivityDetail_Positive()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";

            common = new Common(this.DriverContext);
            rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <String>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <String>("isError"));
                if (member.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("Member is added through PostMember service and following are the details, IPCODE:= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <String>("firstName"));;
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                }
                else
                {
                    testStep.SetOutput(member.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  failed");
                    throw new Exception(member.Value <String>("developerMessage"));
                }
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding transaction through rest service by providing the VCKey for All Fields";
                JObject response = (JObject)rest_Service_Method.PostTransactionWithVCKeyWithAllFields(member["data"]["cards"][0].Value <String>("id"));
                if (response.Value <String>("isError") == "False")
                {
                    testStep.SetOutput("transactios Rowkey:" + response["data"]["transactions"].Value <String>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep);
                }
                else
                {
                    testStep.SetOutput(response.Value <String>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  failed");
                    throw new Exception(response.Value <String>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching Account Details through rest service using Transaction Id";
                String  id     = response["data"]["transactions"].Value <String>("transactionId");
                JObject output = (JObject)rest_Service_Method.GetAccountDetailsByFMS(id);
                //JObject output = (JObject)rest_Service_Method.GetAccountDetailsByFMS("431321139150330186");
                //testStep.SetOutput("saleAmount = " + output["data"][0]["additionalAttributes"][0].Value<string>("attributeValue"));
                testStep.SetOutput("Quantity = " + output["data"][0].Value <double>("quantity"));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating data with data from database";
                String dbresponse = DatabaseUtility.GetQuantityfromDBUsingVCKeyREST(member["data"]["cards"][0].Value <String>("id"));
                testStep.SetOutput("Response from database" + dbresponse);
                Assert.AreEqual(output["data"][0].Value <double>("quantity") + "", dbresponse, "Expected value is " + output["data"][0].Value <double>("saleAmount") + " and actual value is " + dbresponse);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);
                Logger.Info("test passed");
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
                Logger.Info("test  failed" + e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
示例#21
0
        public void BTA375_REST_PostMemberToTargetedPromotion_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <string>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <string>("isError"));
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("Member is added through PostMember service and following are the details, IPCODE:= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName"));;
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                }
                else
                {
                    testStep.SetOutput("PostMember service call failed with following developer message: \"" + member.Value <string>("developerMessage") + "\"");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  failed");
                    throw new Exception(member.Value <string>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding targeted promotion through rest service by providing the member.firstName and options.promotionCode as parameter";
                response = (JObject)rest_Service_Method.PostMemberToTargetedPromotion(member["data"].Value <string>("firstName"), DatabaseUtility.GETRecentPromotionfromDBREST());
                if (response.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("The following promotion with ; memberpromotionID: " + response["data"].Value <int>("id") +
                                       "; Promotion ID : " + response.SelectToken("data.promotion").Value <string>("id") +
                                       "; Promotion name: " + response.SelectToken("data.promotion").Value <string>("name") +
                                       "; has been added to the member : " + member["data"].Value <string>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validating data with data from database";
                    string dbresponse = DatabaseUtility.GetMemberPromotionsUsingIpcodefromDBREST(member["data"].Value <int>("id") + "");
                    testStep.SetOutput("Response from DB  memberpromotionID  " + dbresponse);
                    Assert.AreEqual(response["data"].Value <int>("id") + "", dbresponse, "Expected value is " + response["data"].Value <int>("id") + " and actual value is " + dbresponse);
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA370_REST_GetMemberActivitySummary_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName") + "; VC_KEY= " + member["data"]["cards"][0].Value <string>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(member.Value <string>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding transaction through rest service by providing the VCKey";
                response = (JObject)rest_Service_Method.PostTransactionWithVCKeyWithAllFields(member["data"]["cards"][0].Value <string>("id"));
                if (response.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("transaction rowKey : " + response["data"]["transactions"].Value <string>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testStep = TestStepHelper.StartTestStep(testStep);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching Activity Details through rest service using IPCODE";
                JObject output = (JObject)rest_Service_Method.GetMemberActivitySummaryByIpCode(member["data"].Value <int>("id") + "");
                if (response.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("TransactionsId (TxnHeaderID) is = " + output["data"]["transactionSummaries"][0].Value <string>("transactionId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validate transactionId, transactionDate and transactionAmount from the response";
                    Assert.AreEqual(output["data"]["transactionSummaries"][0].Value <string>("transactionId"), response["data"]["transactions"].Value <string>("transactionId"), "Expected value is " + response["data"]["transactions"].Value <string>("transactionId") + " and actual value is " + output["data"]["transactionSummaries"][0].Value <string>("transactionId"));
                    testStep.SetOutput("TransactionsId (TxnHeaderID) is = " + output["data"]["transactionSummaries"][0].Value <string>("transactionId") +
                                       ", TransactionDate  is = " + output["data"]["transactionSummaries"][0].Value <string>("transactionDate") +
                                       " and TransactionsAmount is = " + output["data"]["transactionSummaries"][0].Value <string>("transactionAmount"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test  Passed");
                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
                Logger.Info("test  failed" + e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }