예제 #1
0
class Test_002_DDT_Login:
    baseURl = ReadConfig.getAppUrl()
    path = ".//testData/login_data_DDT.xlsx"
    logger = LogGen.logGen()

    def test_DDT_login(self):
        self.driver = webdriver.Chrome(
            executable_path=".\\venv\\chromedriver_win32\\chromedriver")
        self.driver.get(self.baseURl)
        self.driver.implicitly_wait(5)
        self.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')

        list_status = []
        for r in range(2, self.rows + 1):
            self.userName = XLUtils.readData(self.path, 'Sheet1', r, 1)
            self.password = XLUtils.readData(self.path, 'Sheet1', r, 2)
            self.exp = XLUtils.readData(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.userName)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(5)

            act_title = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"

            if act_title == exp_title:
                if self.exp == 'pass':
                    self.logger.info("********Passed********")
                    self.lp.clickLogout()
                    list_status.append('pass')

                elif self.exp == 'fail':
                    self.logger.info("***********Failed**********")
                    self.lp.clickLogout()
                    list_status.append('fail')

            elif act_title != exp_title:
                if self.exp == 'fail':
                    self.logger.info("********Passed********")
                    list_status.append('pass')

                elif self.exp == 'pass':
                    self.logger.info("***********Failed**********")
                    list_status.append('fail')

        if 'fail' not in list_status:
            self.logger.info("Login_DDT_test Passed")
            self.driver.close()
            assert True

        else:
            self.logger.error("Login_DDT_Test is failed")
            self.driver.close()
            assert False

        self.logger.info("**********End of TC_002_DDT_login**********")
예제 #2
0
class Test_no_login_ddt():

    baseURL = ReadConfig.getApplicationURL()
    path = ".//TestData/LoginData.xlsx"
    logger = LogGen.loggen()

    def test_login_ddt(self, setup):
        self.logger.info("*********test no. 1***********")
        self.logger.info("*********verifying Login DDT test***********")
        self.driver = setup
        self.driver.get(self.baseURL)

        self.lp = LoginPage(self.driver)
        self.rows = ExcelUtils.getRowCount(self.path, 'sheet1')
        print("Number of Row: ", self.rows)

        lst_status = []  #empty list vars

        for row in range(2, self.rows + 1):
            self.username = ExcelUtils.readData(self.path, 'sheet1', row, 1)
            self.password = ExcelUtils.readData(self.path, 'sheet1', row, 2)
            self.exp = ExcelUtils.readData(self.path, 'sheet1', row, 3)

            self.lp.setUserName(self.username)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(5)

            act_title = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"

            if act_title == exp_title:
                if self.exp == "Pass":
                    self.logger.info("***Passed***")
                    self.lp.clickLogout()
                    lst_status.append("Pass")
                elif self.exp == "Fail":
                    self.logger.info("**Failed***")
                    self.lp.clickLogout()
                    lst_status.append("Fail")
            elif act_title != exp_title:
                if self.exp == "Pass":
                    self.logger.info("***Failed***")
                    lst_status.append("Fail")
                elif self.exp == "Fail":
                    self.logger.info("***Passed***")
                    lst_status.append("Pass")

        if "Fail" not in lst_status:
            self.logger.info("***Login DDT test has passed***")
            self.driver.close()
            assert True
        else:
            self.logger.info("***Login DDT test has failed***")
            self.driver.close()
            assert False

        self.logger.info(lst_status)
        self.logger.info("end of test")
예제 #3
0
 def test_login(self,setup):
     logger.info("************************* Verifying Login Test ******************")
     self.driver = setup
     self.driver.get(self.baseurl)
     lp=LoginPage(self.driver)
     lp.setUserName(self.username)
     lp.setPassword(self.password)
     lp.clickLogin()
     actual_title = self.driver.title
     lp.clickLogout()
     if actual_title == "Dashboard / nopCommerce administration":
         assert True
         self.driver.close()
         logger.info("********************** Login Home page passed ***************")
     else:
         self.driver.save_screenshot(".\\Screenshots\\test_login.png")
         self.driver.close()
         assert False
         logger.info("*************************** LOgin test failed and captured SS: ****************")
예제 #4
0
class Test_002_DDT_Login:
    baseURL = readConfig.getApplicationURL()
    path = ".//Testdata/xltestdata.xlsx"
    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_login_ddt(self, setup):
        self.logger.info("****Test_002_DDT_Login")
        self.logger.info("**********verify login_ddt test*************")
        self.driver = setup
        self.driver.get(self.baseURL)

        self.lp = LoginPage(self.driver)

        self.rows = ExcelUtils.getRowCount(self.path, 'Sheet1')
        print("no.of rows in excel", self.rows)

        lst_status = []  #empty list variable

        for r in range(2, self.rows + 1):
            self.user = ExcelUtils.readdata(self.path, 'Sheet1', r, 1)
            self.password = ExcelUtils.readdata(self.path, 'Sheet1', r, 2)
            self.exp = ExcelUtils.readdata(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.user)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(5)

            act_title = self.driver.title
            exp_title = "Dashboard/nopCommerce administration"

            if act_title == exp_title:
                if self.exp == "Pass":
                    self.logger.info("******passed")
                    self.lp.clickLogout()
                    lst_status.append("pass")
                elif self.exp == "fail":
                    self.logger.info("*********failed*****")
                    self.lp.clickLogout()
                    lst_status.append("fail")

            elif act_title != exp_title:
                if self.exp == 'Pass':
                    self.logger.info("********failed*****")
                    lst_status.append("Fail")
                elif self.exp == 'fail':
                    self.logger.info("*********passed****")
                    lst_status.append("Pass")

        if "Fail" not in lst_status:
            self.logger.info("**********login ddt test passed****")
            self.driver.close()
            assert True
        else:
            self.logger.info("**********login ddt test failed****")
            self.driver.close()
            assert False

        self.logger.info("end of login ddt test")
        self.logger.info("completed test_002_login_ddt")
예제 #5
0
class Test_002_login_ddt():
    global logger
    baseurl = ReadConfig.getApplicationUrl()
    path = ".//TestData/LoginData.xlsx"
    logger = getCustomerLogger(logging.INFO)

    @pytest.mark.regression
    def test_login_ddt(self, setup):
        logger.info(
            "***********************Test_02_login_DDT***************************"
        )
        logger.info(
            "*********************** Verifying login test ddt ******************"
        )
        self.driver = setup
        self.driver.get(self.baseurl)
        self.lp = LoginPage(self.driver)
        self.rows = XLUtils.getRowCount(file=self.path, sheetname='Sheet1')
        print("the number of row count is :", self.rows)
        lst_status = []
        for i in range(2, self.rows + 1):
            print("iterating rown number ", i)
            user = XLUtils.readData(self.path, 'Sheet1', i, 1)
            print("username:"******"password:"******"exp:", exp)
            self.lp.setUserName(user)
            self.lp.setPassword(password)
            self.lp.clickLogin()
            time.sleep(5)

            actual_text = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"

            if actual_text == exp_title:
                if exp == 'Pass':
                    logger.info("*******Passed*********")
                    self.lp.clickLogout()
                    lst_status.append('Pass')
                elif exp == 'Fail':
                    logger.info("********** Failed ********")
                    self.lp.clickLogout()
                    lst_status.append('Fail')
            elif actual_text != exp_title:
                if exp == 'Pass':
                    logger.info("************ failed***********")
                    lst_status.append('Fail')
                elif exp == 'Fail':
                    logger.info("**************** Passed **********")
                    lst_status.append('Pass')

        print("LIst value after appended", lst_status)
        if 'Fail' not in lst_status:
            logger.info(
                "****************Login DDT test Passed*****************")
            self.driver.close()
            assert True
        else:
            logger.info("**************** Failed *************")
            self.driver.close()
            assert False

        logger.info(
            "***************** End of the DDT test case****************")
        logger.info(
            "********************** End of the Test_002_login_DDt test ****************"
        )