Exemple #1
0
        public void ThenUserDetailsAreUpdated()
        {
            extentReporting.createTest("UPDATE_Request_Test");
            dynamic results = JObject.Parse(response);

            try
            {
                if (results != null)
                {
                    // If the updated details are returned
                    Assert.AreEqual((string)results.name, readExcelReader.readExcel(filePath.filePathToExcel(), 6, 2, 2));
                    Assert.AreEqual((string)results.job, readExcelReader.readExcel(filePath.filePathToExcel(), 6, 2, 3));

                    //Verify the response code
                    Assert.AreEqual(responseStatus, readExcelReader.readExcel(filePath.filePathToExcel(), 6, 3, 2));
                }
                else
                {
                    // If the updated detals are not returned
                    Assert.AreEqual(responseStatus, readExcelReader.readExcel(filePath.filePathToExcel(), 6, 3, 2));
                }

                extentReporting.testStatusWithMsg("Pass", "UPDATE_Request_TestPassed");
            }
            catch (AssertionException e)
            {
                extentReporting.logReportStatement(AventStack.ExtentReports.Status.Error, e.Message);
                extentReporting.testStatusWithMsg("Fail", "UPDATE_Request_TestFailed");
            }

            extentReporting.flushReport();
        }
        public void ThenResourceDetailsShouldDisplay()
        {
            extentReporting.createTest("GET_Request_Test");
            dynamic results  = JObject.Parse(response);
            dynamic array    = jsonRead.LoadJson();
            dynamic results2 = JObject.Parse(array);

            //jsonRead.LoadJson();

            try
            {
                Assert.AreEqual((string)results2["data"][0]["id"], (string)results["data"][0]["id"]);
                Assert.AreEqual((string)results2["data"][0]["name"], (string)results["data"][0]["name"]);


                extentReporting.testStatusWithMsg("Pass", "GET_Request_TestPassed");
            }
            catch (AssertionException e)
            {
                extentReporting.logReportStatement(AventStack.ExtentReports.Status.Error, e.Message);
                extentReporting.testStatusWithMsg("Fail", "GET_Request_TestFailed");
            }

            extentReporting.flushReport();
        }
Exemple #3
0
        public void ThenUserDetailsAreDeleted()
        {
            extentReporting.createTest("DELETE_Request_Test");

            try
            {
                Assert.AreEqual(responseStatus, readExcelReader.readExcel(filePath.filePathToExcel(), 7, 1, 2));

                extentReporting.testStatusWithMsg("Pass", "DELETE_Request_TestPassed");
            }
            catch (AssertionException e)
            {
                extentReporting.logReportStatement(AventStack.ExtentReports.Status.Error, e.Message);
                extentReporting.testStatusWithMsg("Fail", "DELETE_Request_TestFailed");
            }

            extentReporting.flushReport();
        }
Exemple #4
0
        public void ThenIGetTheUserDetails()
        {
            extentReporting.createTest("GET_Request_Test");
            dynamic results = JObject.Parse(response);

            try
            {
                //For the 1st object
                Assert.AreEqual((string)results.data[0].id, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 2, 2));
                Assert.AreEqual((string)results.data[0].first_name, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 2, 3));
                Assert.AreEqual((string)results.data[0].last_name, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 2, 4));
                Assert.AreEqual((string)results.data[0].avatar, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 2, 5));

                //For the 2nd object
                Assert.AreEqual((string)results.data[1].id, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 3, 2));
                Assert.AreEqual((string)results.data[1].first_name, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 3, 3));
                Assert.AreEqual((string)results.data[1].last_name, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 3, 4));
                Assert.AreEqual((string)results.data[1].avatar, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 3, 5));

                //For the 3rd object
                Assert.AreEqual((string)results.data[2].id, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 4, 2));
                Assert.AreEqual((string)results.data[2].first_name, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 4, 3));
                Assert.AreEqual((string)results.data[2].last_name, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 4, 4));
                Assert.AreEqual((string)results.data[2].avatar, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 4, 5));

                //Verify the response code
                Assert.AreEqual(responseStatus, readExcelReader.readExcel(filePath.filePathToExcel(), 2, 5, 2));

                extentReporting.testStatusWithMsg("Pass", "GET_Request_TestPassed");
            }
            catch (AssertionException e)
            {
                extentReporting.logReportStatement(AventStack.ExtentReports.Status.Error, e.Message);
                extentReporting.testStatusWithMsg("Fail", "GET_Request_TestFailed");
            }

            extentReporting.flushReport();
        }