乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      python關(guān)鍵字UI自動(dòng)化測(cè)試框架(4)-主運(yùn)行函數(shù)封裝

       小豬窩969 2019-12-09

      利用python的getattr自省方法,執(zhí)行excle中定義的方法========


      from unit.operExcle import operExcle

      from unit.base import ActtionMethod

      from event.asertion import Assert

      from event.log_event import *

      from event.log_event import log

      class TestCase:

           oper = operExcle()

           lines = oper.get_lines()

           action_method = ActtionMethod()

           True_sum = 0

           false_sum=0

           def excle_value(self):

               try:

                   for i in range(2, self.lines+1):

                       #是否執(zhí)行

                       is_run = self.oper.get_value(i,3)

                       if is_run=="yes":

                           #method

                           method = self.oper.get_value(i,4)

                           #獲取定位元素

                           locator = self.oper.get_value(i,5)

                           #用戶輸入內(nèi)容

                           content = self.oper.get_value(i,6)

                           #預(yù)期結(jié)果

                           per = self.oper.get_value(i,7)

                           log.info(f"執(zhí)行【{method}】操作")

                           result = self.run_action(method,content,locator)

                           self.oper.write_data(i,8,result)

                           ret=Assert(i,9,per,result)

                           if  ret:

                               self.oper.write_data(i,10,1)

                           else:

                               self.oper.write_data(i,10,0)

                               self.run_action("screenshot",f"預(yù)期值【{per}】和實(shí)際值【{result}】不一致")

               except Exception as e:

                   raise e

               finally:

                        self.total()

           def run_action(self,method,*args):

               action_function=getattr(self.action_method,method)

               result=action_function(*args)

               return  result

           def total(self):

               for i in range(2, self.lines):

                   if self.oper.get_value(i, 10) == 0:

                       self.false_sum += 1

                   elif self.oper.get_value(i, 10) == 1:

                       self.True_sum += 1

               log.info(f"成功案例數(shù):{self.True_sum},失敗案例數(shù):{self.false_sum}")

      if __name__=="__main__":

          testcase = TestCase()

          print(testcase.excle_value())

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多