Ejemplo n.º 1
0
        public void LoginTestCase()
        {
            /// Test case name
            testScriptName = "LoginTestCase";

            try
            {
                /// Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                /// Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);

                /// Test Data
                TestData testData = new TestData(testDataFilePath);
                string schooltechUName = (string)testData.TestDataTable["SchooltechUName"];
                string schooltechPassword = (string)testData.TestDataTable["SchooltechPassword"];

                /// Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                /// Log in as Schooltech
                SchoolTechHomePage st_Homepage = loginPage.LoginAsSchoolTech(schooltechUName, schooltechPassword, base.applicationURL);
                Assert.IsNotNull(st_Homepage, "Failed to login to InPods application as Schooltech");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Schooltech", "Pass", browser);
                stepNo++;

                /// Validate if the login is of type SchoolTech
                Assert.IsTrue(st_Homepage.ValidateSchoolTechUserProfile(), "Failed to validate current login as Schooltech");
                WriteLogs(testScriptName, stepNo, "Validate current Login as Schooltech", "Pass", browser);
            }
               catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in  \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Ejemplo n.º 2
0
        public void CreateUsersOfEachRoleType()
        {
            ///Test name
            testScriptName = "CreateUsersOfEachRoleType";

            try
            {
                // Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                // Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);
                string testDataDirectoryPath = PrepareTestDataDirectory(testScriptName);

                // Test Data
                TestData testData = new TestData(testDataFilePath);
                string schooltechUName = (string)testData.TestDataTable["schooltechUName"];
                string schooltechPassword = (string)testData.TestDataTable["schooltechPassword"];

                string teacherRole = (string)testData.TestDataTable["teacherRole"];
                string firstNameTeacher = (string)testData.TestDataTable["firstNameTeacher"];
                string lastNameTeacher = (string)testData.TestDataTable["lastNameTeacher"];
                string emailTeacher = (string)testData.TestDataTable["emailTeacher"];
                string passwordTeacher = (string)testData.TestDataTable["passwordTeacher"];

                string parentRole = (string)testData.TestDataTable["parentRole"];
                string firstNameParent = (string)testData.TestDataTable["firstNameParent"];
                string lastNameParent = (string)testData.TestDataTable["lastNameParent"];
                string emailParent = (string)testData.TestDataTable["emailParent"];
                string passwordParent = (string)testData.TestDataTable["passwordParent"];

                string authorRole = (string)testData.TestDataTable["authorRole"];
                string firstNameAuthor = (string)testData.TestDataTable["firstNameAuthor"];
                string lastNameAuthor = (string)testData.TestDataTable["lastNameAuthor"];
                string emailAuthor = (string)testData.TestDataTable["emailAuthor"];
                string passwordAuthor = (string)testData.TestDataTable["passwordAuthor"];

                string administratorRole = (string)testData.TestDataTable["administratorRole"];
                string firstNameAdministrator = (string)testData.TestDataTable["firstNameAdministrator"];
                string lastNameAdministrator = (string)testData.TestDataTable["lastNameAdministrator"];
                string emailAdministrator = (string)testData.TestDataTable["emailAdministrator"];
                string passwordAdministrator = (string)testData.TestDataTable["passwordAdministrator"];

                string schooltechRole = (string)testData.TestDataTable["schooltechRole"];
                string firstNameSchooltech = (string)testData.TestDataTable["firstNameSchooltech"];
                string lastNameSchooltech = (string)testData.TestDataTable["lastNameSchooltech"];
                string emailSchooltech = (string)testData.TestDataTable["emailSchooltech"];
                string passwordSchooltech = (string)testData.TestDataTable["passwordSchooltech"];

                string studentRole = (string)testData.TestDataTable["studentRole"];
                string firstNameStudent = (string)testData.TestDataTable["firstNameStudent"];
                string lastNameStudent = (string)testData.TestDataTable["lastNameStudent"];
                string emailStudent = (string)testData.TestDataTable["emailStudent"];
                string passwordStudent = (string)testData.TestDataTable["passwordStudent"];

                // Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                // Log in as Schooltech
                SchoolTechHomePage s_Homepage = loginPage.LoginAsSchoolTech(schooltechUName, schooltechPassword, base.applicationURL);
                Assert.IsNotNull(s_Homepage, "Failed to login to InPods application as Schooltech");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Schooltech", "Pass", browser);
                stepNo++;

                // Navigate to schooltech admin
                SchoolTechAdminPage admin = s_Homepage.GoToSchooltechAdmin();
                Assert.IsNotNull(admin, "Failed to navigate to Schooltech Admin Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Schooltech Admin Page", "Pass", browser);
                stepNo++;

                // Navigate to User Management page
                SchoolTechUserManagementPage manage = admin.GotoUserManagementPage();
                Assert.IsNotNull(manage, "Failed to navigate to User management Page");
                WriteLogs(testScriptName, stepNo, "Navigate to User management Page", "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Teacher'
                Assert.IsTrue(manage.CreateUser(teacherRole, firstNameTeacher, lastNameTeacher, emailTeacher, passwordTeacher), "Unable to Create User of type " + teacherRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + teacherRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Parent'
                Assert.IsTrue(manage.CreateUser(parentRole, firstNameParent, lastNameParent, emailParent, passwordParent), "Unable to Create User of type " + parentRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + parentRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Author'
                Assert.IsTrue(manage.CreateUser(authorRole, firstNameAuthor, lastNameAuthor, emailAuthor, passwordAuthor), "Unable to Create User of type " + authorRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + authorRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Administrator'
                Assert.IsTrue(manage.CreateUser(administratorRole, firstNameAdministrator, lastNameAdministrator, emailAdministrator, passwordAdministrator), "Unable to Create User of type " + administratorRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + administratorRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Schooltech'
                Assert.IsTrue(manage.CreateUser(schooltechRole, firstNameSchooltech, lastNameSchooltech, emailSchooltech, passwordSchooltech), "Unable to Create User of type " + schooltechRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + schooltechRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Student'
                Assert.IsTrue(manage.CreateUser(studentRole, firstNameStudent, lastNameStudent, emailStudent, emailStudent), "Unable to Create User of type " + studentRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + studentRole, "Pass", browser);
                stepNo++;

                /// LogOff
                Assert.IsTrue(manage.LogOut(), "Failed to Log out");
                WriteLogs(testScriptName, stepNo, "LogOff", "Pass", browser);
            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Ejemplo n.º 3
0
        public void CreateTechadminAndInstituteManually()
        {
            ///Test name
            testScriptName = "CreateTechadminAndInstituteManually";

            try
            {
                /// Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                /// Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);
                string testDataDirectoryPath = PrepareTestDataDirectory(testScriptName);

                /// Test Data
                TestData testData = new TestData(testDataFilePath);
                string superUName = (string)testData.TestDataTable["SuperUName"];
                string superPassword = (string)testData.TestDataTable["SuperPassword"];
                string firstName = (string)testData.TestDataTable["FirstName"];
                string lastName = (string)testData.TestDataTable["LastName"];
                string email  = (string)testData.TestDataTable["Email"];
                string password = (string)testData.TestDataTable["Password"];
                string instituteName = (string)testData.TestDataTable["InstituteName"];
                string instituteDescription = (string)testData.TestDataTable["InstituteDescription"];
                string instituteShortName= (string)testData.TestDataTable["InstituteShortName"];
                string logoFilePath= testDataDirectoryPath + (string)testData.TestDataTable["LogoFileName"];
                string schoolTechName= (string)testData.TestDataTable["SchoolTechName"];
                string timeZone= (string)testData.TestDataTable["TimeZone"];
                string passwordReset= (string)testData.TestDataTable["PasswordReset"];

                /// Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                /// Log in as Super
                SuperHomePage s_Homepage = loginPage.LoginAsSuper(superUName, superPassword, base.applicationURL);
                Assert.IsNotNull(s_Homepage, "Failed to login to InPods application as Super");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Super", "Pass", browser);
                stepNo++;

                /// Go to Admin Page
                SuperAdminPage admin = s_Homepage.GotoSuperAdminPage();
                Assert.IsNotNull(admin, "Failed to navigate to super admin page");
                WriteLogs(testScriptName, stepNo, "Navigate to Admin page", "Pass", browser);
                stepNo++;

                /// Click on CreateInstitute Link
                CreateInstitutePage newInstitute = admin.GoToCreateInstitutePage();
                Assert.IsNotNull(newInstitute, "Failed to navigate to Create Institute Page");
                WriteLogs(testScriptName, stepNo, "Navigate to CreateNewInstitutePage", "Pass", browser);
                stepNo++;

                /// Create TechAdmin as schooltech
                Assert.IsTrue(newInstitute.CreateTechadmin(firstName, lastName, email, password), "Failed to create tech admin");
                WriteLogs(testScriptName, stepNo, "Create TechAdmin", "Pass", browser);
                stepNo++;

                /// Add new institute
                Assert.IsTrue(newInstitute.AddNewInstitute(instituteName, instituteDescription, instituteShortName, logoFilePath, schoolTechName, timeZone, passwordReset), "Failed to create new institute");
                WriteLogs(testScriptName, stepNo, "Create New institute", "Pass", browser);
                stepNo++;

                /// LogOff
                Assert.IsTrue(newInstitute.LogOut(), "Failed to Log out");
                WriteLogs(testScriptName, stepNo, "LogOff", "Pass", browser);
            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Ejemplo n.º 4
0
        public void CreateSemester()
        {
            ///Test name
            testScriptName = "CreateSemester";

            try
            {
                // Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                // Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);
                string testDataDirectoryPath = PrepareTestDataDirectory(testScriptName);

                // Test Data
                TestData testData = new TestData(testDataFilePath);
                string schooltechUName = (string)testData.TestDataTable["schooltechUName"];
                string schooltechPassword = (string)testData.TestDataTable["schooltechPassword"];

                string semesterTitle = (string)testData.TestDataTable["semesterTitle"];
                string semesterYear = (string)testData.TestDataTable["semesterYear"];
                string semesterDescription = (string)testData.TestDataTable["semesterDescription"];
                string schoolYear = (string)testData.TestDataTable["schoolYear"];
                string startDate = (string)testData.TestDataTable["startDate"];
                string endDate = (string)testData.TestDataTable["endDate"];

                // Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                // Log in as Schooltech
                SchoolTechHomePage s_Homepage = loginPage.LoginAsSchoolTech(schooltechUName, schooltechPassword, base.applicationURL);
                Assert.IsNotNull(s_Homepage, "Failed to login to InPods application as Schooltech");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Schooltech", "Pass", browser);
                stepNo++;

                // Navigate to schooltech admin
                SchoolTechAdminPage admin = s_Homepage.GoToSchooltechAdmin();
                Assert.IsNotNull(admin, "Failed to navigate to Schooltech Admin Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Schooltech Admin Page", "Pass", browser);
                stepNo++;

                // Navigate to Course Management page
                SchoolTechCourseManagementPage manage = admin.GotoCourseManagementPage();
                Assert.IsNotNull(manage, "Failed to navigate to Manage Course Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Manage Course Page", "Pass", browser);
                stepNo++;

                // Navigate to create Semester page
                CreateSemesterPage semester = manage.GoToCreateSemesterPage();
                Assert.IsNotNull(manage, "Failed to navigate to Create Semester Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Create Semester Page", "Pass", browser);
                stepNo++;

                // Create new semester
                Assert.IsTrue(semester.CreateNewSemester(semesterTitle, semesterYear, semesterDescription, schoolYear, startDate, endDate), "Unable to create new semester");
                WriteLogs(testScriptName, stepNo, "Create new semester " + semesterTitle, "Pass", browser);
                stepNo++;

                // Log out
                Assert.IsTrue(manage.LogOut(), "Failed to Log out");
                WriteLogs(testScriptName, stepNo, "LogOff", "Pass", browser);
            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + "And Exception Occured in \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Ejemplo n.º 5
0
        public void TestCase2101()
        {
            int stepNo = 1;

            // Gets scriptname through reflection
            string testScriptName = GetTestScriptName();

            // Loads config data and creates a Singleton object of Configuration and loads data into generic test case variables
            this.GetConfigData();

            // Get process exe file path
            string[] processPath = PrepareProcessFilePath();

            // Get debug viewer exe file path
            string configFilesLocation = PrepareConfigureDataFilePath();

            // Get log directory details from xml file
            PrepareLogDirectoryPath(configFilesLocation);

            // Start debug viewer
            ApplicationLog applicationLog = new ApplicationLog();
            applicationLog.StartDebugViewer(configFilesLocation, reportFileDirectory, testScriptName);

            // Prepare test data file path
            string testDataFilePath = PrepareTestDataFilePath(testScriptName);

            // Loads test case specific data
            TestData testData = new TestData(testDataFilePath);
            string applicationName = (string)testData.TestDataTable["ApplicationName"];
            string[] applicationsName = applicationName.Split(',');
            string pageNumber = (string)testData.TestDataTable["PageNumber"];
            string fileName = (string)testData.TestDataTable["FileName"];

            //file path to upload
            fileName = PrepareDocumentPath(testScriptName, fileName);

            CleanUpTestScripts.CleanUp_2100 cleanUp_2100 = new CleanUpTestScripts.CleanUp_2100();

            SessionHandler sessionHandler = new SessionHandler();
            Browser browser = sessionHandler.GetBrowserInstance();
            try
            {
                // Execute all clean up scripts if marked as true in xml file
                try
                {
                    // store session in session handler
                    sessionHandler.StoreBrowserInstance(browser);
                    // Execute all clean up scripts if marked as true in xml file
                    CleanUpExecution cleanUpExecution = new CleanUpExecution();
                    cleanUpExecution.ExecuteCleanUp(configFilesLocation, this.projectDirectory);
                    // get browser session from session handler
                    browser = sessionHandler.GetBrowserInstance();
                }
                catch (Exception) { }
                //// call clean up script for test script
                //try
                //{
                //    sessionHandler.StoreBrowserInstance(browser);
                //    cleanUp_2100.CleanUp2100();
                //    browser = sessionHandler.GetBrowserInstance();
                //}
                //catch (Exception) { }
                try
                {
                    SearchPage searchPageNew = new SearchPage(browser);
                    bool isMenuSelectedFlag = searchPageNew.SelectMenuItem("Search", null, null);
                    Assert.IsTrue(isMenuSelectedFlag, "Navigation to search page failed.");
                    WriteLogs(testScriptName, stepNo, "Navigation to search page passed.", "PASS", browser);
                }
                catch (Exception)
                {
                    browser = null;
                }
                if (null == browser)
                {

                    browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation);
                    LoginPage loginPage = new LoginPage(browser);
                    SearchPage searchPageNew = loginPage.Login(this.userName, this.password, this.applicationURL, this.timeout, processPath);
                    searchPageNew.LocateControls();
                    Assert.IsNotNull(searchPageNew, "Failed to login in application");
                }

                WriteLogs(testScriptName, stepNo, "Verify ILS has been enabled for the application - in prerequisite", "PASS", browser);

                stepNo++;
                SearchPage searchPage = new SearchPage(browser);
                bool isSelected = searchPage.SelectMenuItem("Admin", "User Configurations", null);
                Assert.IsTrue(isSelected, "Failed to navigate to Search page");
                WriteLogs(testScriptName, stepNo, "Go to admin tab. Select user configuration. all iSynergy users are listed", "PASS", browser);

                stepNo++;
                UserConfigurationPage userConfigurationPage = new UserConfigurationPage(browser);
                UserPermissionPage userPermissionPage = new UserPermissionPage(browser);
                userPermissionPage = userConfigurationPage.ClickAccessUserConfiguration(this.userName);
                Assert.IsNotNull(userPermissionPage, "Failed to select the key next to sysadmin user");
                WriteLogs(testScriptName, stepNo, "select the key next to sysadmin user. User permissions screen appears. ", "PASS", browser);

                stepNo++;
                IndexLevelPermissionPage indexLevelPermissionPage = new IndexLevelPermissionPage(browser);
                indexLevelPermissionPage = userPermissionPage.NavigateToIndexLevelPermissionsPage(applicationName);
                Assert.IsNotNull(indexLevelPermissionPage,"Failed to select the Configuration gear icon under ILS configuration for the application "+applicationName);
                WriteLogs(testScriptName,stepNo,"Under application Permissions, select the Configuration gear icon under ILS configuration for the application in which ILS was enabled on An index field. Index Level Permissions configuration screen appears. Each ILS enabled index field for the application should be listed. A view column with check boxes and an edit column with check boxes Should be displayed. ","PASS",browser);

                stepNo++;
                indexLevelPermissionPage = indexLevelPermissionPage.SelectViewOrEditIndexLevelPermissions("View","ST1");
                Assert.IsNotNull(indexLevelPermissionPage, "View ILS options selected");

                userPermissionPage = indexLevelPermissionPage.ClickUpdateButtonAppConfILS();
                Assert.IsNotNull(userPermissionPage, "ILS Permission Update button clicked");

                userConfigurationPage = userPermissionPage.ClickUpdateButtonUserPermission();
                Assert.IsNotNull(userConfigurationPage, "User Permission Update button clicked");
                WriteLogs(testScriptName,stepNo,"Select the index field. Check the view check box To enable. Leave edit disabled. Click update button. ","PASS",browser);

            }
            catch (Exception exception)
            {
                ExceptionCleanUp(testScriptName, stepNo, exception.Message, browser);
            }
            finally
            {
                sessionHandler.StoreBrowserInstance(browser);
                //cleanUp_2100.CleanUp2100();
                stepNo++;
                // to stop debeg viewer
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Ejemplo n.º 6
0
        public void TestCaseLogin()
        {
            int stepNo = 1;

            string test = TestContext.TestName;

            // Gets scriptname through reflection
            string testScriptName = GetTestScriptName();

            // Loads config data and creates a Singleton object of Configuration and loads data into generic test case variables
            this.GetConfigData();

            // Get process exe file path
            string[] processPath = PrepareProcessFilePath();

            // Get debug viewer exe file path
            string configFilesLocation = PrepareConfigureDataFilePath();

            // Get log directory details from xml file
            PrepareLogDirectoryPath(configFilesLocation);

            // Start debug viewer
            ApplicationLog applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
            applicationLog.StartDebugViewer();

            // Prepare test data file path
            string testDataFilePath = PrepareTestDataFilePath(testScriptName);

            // Loads test case specific data
            TestData testData = new TestData(testDataFilePath);
            string resourceType = (string)testData.TestDataTable["ResourceType"];
            string provider = (string)testData.TestDataTable["Provider"];
            string resourceDescription = (string)testData.TestDataTable["ResourceDescription"];
            SessionHandler sessionHandler = new SessionHandler();
            Browser browser = sessionHandler.GetBrowserInstance();

            try
            {
                try
                {
                    // store session in session handler
                    sessionHandler.StoreBrowserInstance(browser);

                    // get browser session from session handler
                    browser = sessionHandler.GetBrowserInstance();
                }
                catch (Exception)
                { }

                VirtualMachinePage virtualMachinePage = null;
                LoginPage loginPage = null;

                try
                {

                    virtualMachinePage.LocateControls();

                }
                catch (Exception)
                {
                    browser = null;
                }

                if (null == browser)
                {

                    //Create Browser Instance
                    browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                    //Login to ComputeNext Application
                    loginPage = new LoginPage(browser);
                    virtualMachinePage = loginPage.Login(this.userName, this.password, this.applicationURL, this.timeout, processPath);
                    virtualMachinePage.LocateControls();
                    Assert.IsNotNull(virtualMachinePage, "Failed to login to ComputeNext application ");
                    WriteLogs(testScriptName, stepNo, "Login to ComputeNext Application", "Pass", browser);

                    //Select Resource Type
                    stepNo++;
                    virtualMachinePage = virtualMachinePage.SelectResourceType(resourceType);
                    Assert.IsNotNull(virtualMachinePage, "Failed to Select Resource Type ");
                    WriteLogs(testScriptName, stepNo, "Resource Type Selected", "Pass", browser);

                    stepNo++;
                    virtualMachinePage = virtualMachinePage.SelectProvider(provider);
                    Assert.IsNotNull(virtualMachinePage, "Failed To Select Provider");
                    WriteLogs(testScriptName, stepNo, "Provider Selected", "Pass", browser);

                    stepNo++;
                    virtualMachinePage = virtualMachinePage.AddResourceToWorkSpace(resourceDescription);
                    Assert.IsNotNull(virtualMachinePage, "Failed To Add Resource To Workspace");
                    WriteLogs(testScriptName, stepNo, "Resource Added To Workspace", "Pass", browser);

                    stepNo++;
                    WorkspacePage workspacePage = virtualMachinePage.clickWorkSpaceButton();
                    Assert.IsNotNull(workspacePage, "Failed To Click Workspace Button");
                    WriteLogs(testScriptName, stepNo, "Workspace Button Clicked", "Pass", browser);

                    stepNo++;
                    DashboardPage DashboardPage = workspacePage.ActivateWorkload();
                    Assert.IsNotNull(DashboardPage, "Failed To Activate Workload");
                    WriteLogs(testScriptName, stepNo, "Activate Workload", "Pass", browser);

                    stepNo++;
                    //LogOut ComputeNext Application
                    bool isLoggedOut = loginPage.LogOut();
                    Assert.IsTrue(isLoggedOut, "Failed to Log Out to ComputeNext Application");
                    WriteLogs(testScriptName, stepNo, "Log Out to ComputeNext Application", "Pass", browser);
                }

            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in " + testScriptName, "FAIL", browser);
            }
            finally
            {
                sessionHandler.StoreBrowserInstance(browser);
                HomePage homePage = new HomePage(browser);
                homePage.LogOut();
                stepNo++;
                // to stop debug viewer
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }