• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    用 STAF/STAX + LAMP 實現多任務的自動化測試框架

    發布: 2009-5-25 18:55 | 作者: 網絡轉載 | 來源: 測試時代采編 | 查看: 147次 | 進入軟件測試論壇討論

    領測軟件測試網

    MILY: Arial">

    清單 1. queuemgr.xml 中的 check-queue 函數

    <function name="check-queue"> 
    <sequence>
      <block name="'Queue Manager'">
      <sequence>
       <stafcmd name="'Check Queue'">
       <location>'local'</location>
       <service>'FS'</service>
       <request>'LIST DIRECTORY %s TYPE F SORTBYNAME' % queueDir</request>
       </stafcmd>
       <script>dirList = STAFResult</script>     
       <script>taskCount = len(dirList)</script>
       <script>      
       if (taskCount != 0):        # skip an empty list
        taskParam = dirList[0]        # get first entry      
       else:
        taskParam = "empty"            
       </script>
       <if expr=" taskParam != 'empty'">
       <if expr=" lastTaskParam != taskParam">
        <sequence>
        <if expr="TestRunInProgress[0] == 0">
         <script>
         TestRunInProgress[0] = 1
         TestRunStartTime[0] = now()
         </script>
        </if>
        <script>TestRunCtr[0] = TestRunCtr[0] + 1</script>
        <script> lastTaskParam = taskParam </script>
        <script> lastTaskParamJobID = taskParamJobID </script>
        <log>'QueueMgr: Executing taskParam %s' %(taskParam)</log>
        <stafcmd name="'Executing Task: %s' % taskParam">
         <location>'local'</location>
         <service>'STAX'</service>
         <request>'EXECUTE FILE %s CLEARLOGS JOBNAME %s SCRIPT " taskParam='%s'" WAIT
    %s' %(TestExecuteFile, taskParam, taskParam,gblTestExecutionTimeoutMS)</request>
        </stafcmd>
        <script> taskParamJobID = STAFResult</script>
        <log>'QueueMgr: taskParam %s JobID = %s' %( taskParam, taskParamJobID)</log>
        <if expr="RC != STAFRC.Ok">
         <sequence>
         <log>'QueueMgr: Execute Test with Param File %s failed - RC: %s STAFResult: %s'
             %( taskParam,RC,STAFResult)</log>
         <terminate block="'main'"/>
         </sequence>
        </if>
        </sequence>
        <else>
        <sequence>
        <log>'QueueMgr: *** TERMINATING Queue Manager *** Task File %s is the same as the
            last one' %( taskParam)</log>
         <log>'QueueMgr: Please check the completion status of Test Record %s Job ID %s
    and Re-Start the Queue Manager' %( lastTaskParam, lastTaskParamJobID)</log>
         <terminate block="'main'"/>
        </sequence>
        </else>
       </if>
       <else>
        <sequence>      
        <if expr="TestRunInProgress[0] == 1">
         <sequence>        
          <script>
          TestRunInProgress[0] = 0
          TestRunStopTime[0] = now()
          testTime = (TestRunStopTime[0] - TestRunStartTime[0])
          testHrs = int((testTime) / 3600)
          testMin = int((testTime - (testHrs * 3600)) / 60)
          testSec = int((testTime - (testHrs * 3600)) - (testMin * 60))
          TestRunCompletionDateTime = strftime('%a %b %d %Y %H:%M:%S', localtime())
          </script>
          <log>'All tests have been run; the testqueue is empty'</log>
          <log>'Test Run Completed: %s' % TestRunCompletionDateTime</log>
          <log>'%d Test Tasks Were Completed In %d Hrs %d Min %d Sec'
             % (TestRunCtr[0],testHrs,testMin,testSec)</log>         
          <script>TestRunCtr[0] = 0</script>
          <terminate block="'main'"/>
         </sequence>
        </if>  
        <block name="'Queue Check Delay'">
         <stafcmd name="'Checking TestQueue Every 5000 Sec' % gblCheckQueueDelayTimeSec">
         <location>'local'</location>
         <service>'DELAY'</service>
         <request>'DELAY 5000'</request>
         </stafcmd>     
        </block>
        </sequence>
       </else>
       </if>
       <block name="'Queue Process Delay'">
       <stafcmd name="'Checking TestQueue 5000 Sec After Last Task'">
       <location>'local'</location>
       <service>'DELAY'</service>
       <request>'DELAY 5000'</request>
       </stafcmd>     
      </block>
      </sequence>
     </block>
    </sequence>
    </function>

    代碼中第一個延時等待是對空任務隊列的查看周期。測試執行人員根據個人習慣有時候希望先啟動任務隊列執行任務,再生成測試任務參數文件。這時查看隊列的循環不能在第一次遇到隊列為空時就退出,而是要不斷反復查看任務隊列。如果在循環之間不加延時,會造成進程對 CPU 開銷過大,影響其他進程。第二個延時是前后兩個測試任務執行之間的延時。這是為了讓剛結束的測試進程有足夠時間釋放各種資源和執行多個文件操作,如日志文件和測試參數文件的轉移。

      每次循環中獲得測試任務文件列表時要判斷第一個任務參數文件是否在上次循環中已經嘗試執行過。若是,則上次任務肯定沒有正常結束,否則應該將該任務文件轉移到任務結果文件夾中。這時應該中止任務隊列處理進程,提示測試執行人員查看 STAX 日志排除錯誤。

      生成任務參數文件并啟動任務隊列執行的 PHP 代碼如下。該部分代碼在測試者提交了圖 3 所示的測試任務配置表單后執行。

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/

    43/4<1234>

    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>