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

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

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

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

    面向復雜軟件的 Build 自動驗證解決方案

    發布: 2009-5-04 15:05 | 作者: 邵科峰 | 來源: 測試時代采編 | 查看: 49次 | 進入軟件測試論壇討論

    領測軟件測試網

    Build 自動驗證程序按圖 2 所示步驟循環執行。


    圖 2. Build 自動驗證程序
    圖 2. Build 自動驗證程序

    驗證結果發布服務器

    Build 驗證結果需要被持久化存儲,所以我們引入驗證結果發布服務器,開發人員和測試人員可以通過瀏覽器查看所有 Build 的驗證結果。圖 3 展示了驗證結果發布服務器的具體實現,構建(Build)驗證服務器和發布服務器通過數據庫交互,并通過一個 Web 程序進行結果發布;圖 4 則是一個典型的驗證結果發布的實例。


    圖 3. 驗證結果發布服務器的具體實現
    圖 3. 驗證結果發布服務器的具體實現

    圖 4. 構建(Build)驗證結果發布
    圖 4. 構建(Build)驗證結果發布

    驗證結果發布程序的實現相對簡單,我們對此不作展開。 Build 自動驗證程序則是整個解決方案的核心,下面對它的所有步驟逐一說明。

    輪詢下載 Build

    Build 的下載一般通過 FTP 協議完成,雖然 Windows 和 Unix 的命令腳本都提供相信的 FTP 支持,但用命令腳本不易實現各種錯誤(例如網絡錯誤或者 Build 服務器不可訪問)的處理邏輯,因此腳本運行的容錯性和穩定性相對較差。而 Build 自動驗證程序要求在無人干預的情況下 7 × 24 小時工作,所以我們選擇 Java 實現 Build 輪詢下載。圖 5 是 Build 輪詢下載的基本流程,BuildDownload.java 則是該流程的具體實現。


    圖 5. Build 輪詢下載流程
    圖 5. Build 輪詢下載流程

    清單 1. BuildDownload.java
    				public class BuildDownload {  private String server; //Build Server's IP or host name  private int port; //Build Server's FTP port  private String user; //User ID used to log in the Build Server  private String pwd; //Password  private String remoteBuildDir; //The remote build directory on the Build Server  private String localBuildDir; //The local directory to store the downloaded build  private int interval; //The interval minutes to search the new build  public static void main(String[] args) {    //1. Check the input parameter: the full path of the configuration file    if (args.length != 1) {      System.out.println("Error - Invalid parameters.");      System.exit(1);    }    BuildDownload dameon = new BuildDownload(args[0]);    //2. Search and download the newest build    boolean isSuccess = false;    do {      isSuccess = dameon.download();    }    while(!isSuccess);  }  public BuildDownload(String configFile) {  /*Load the specified property file and initialize the configurations*/  }  public boolean download() {    FtpClient client = new FtpClient();    InputStream input = null;    BufferedInputStream buffer = null;    BufferedReader bufferReader = null;    FileOutputStream outfile = null;    try {      System.out.println("Info - Wait " + this.interval + " minutes.");      Thread.sleep(this.interval*60000);      //1. Connect to FTP server      client.openServer(this.server, this.port);      client.login(this.user, this.pwd);      //2. Search the newest build on the Build Server      System.out.println("Info - Search the newest build on the Build Server.");      client.cd(this.remoteBuildDir);      input = client.list();      bufferReader = new BufferedReader(new InputStreamReader(input));      String newest = "00000000000000.zip"; //The format of build name: yyyyMMddHHmmss.zip      while ((temp=bufferReader.readLine())!=null) {        String temp = temp.trim();        int start = temp.lastIndexOf(" ");        temp = temp.substring(start+1);        if ( temp.compareTo(newest) > 0 )          newest = temp;      }      bufferReader.close();      input.close();      System.out.println("Info - The newest build on the Build Server is " + newest);      //3. Compare the remote newest build with the latest verified build      String latestVerifiedBuild = getLatestVerifiedBuildID();      if (latestVerifiedBuild.compareTo(newest) >= 0) {        client.closeServer();        System.out.println("Info - The build " + newest + " has been verified.");        return false;      }      System.out.println("Info - A new build " + newest + " is ready.");      //4. Download the newest build      clearLocalDirectory();      System.out.println("Info - Start to download the build " + newest);      client.binary();      input = (InputStream)client.get(this.remoteBuildDir + "/" + newest);      buffer = new BufferedInputStream(input);      outfile = new FileOutputStream(this.localBuildDir + "/" + newest, true);      int content;      while((content=buffer.read()) != -1) {        outfile.write(content);      }      outfile.flush();      outfile.close();      buffer.close();      input.close();      client.closeServer();      System.out.println("Info - Finish to download the build " + newest);      return true;    }    catch (Exception e) {      e.printStackTrace();      System.out.println("Error - Unexpected exception happened.");      return false;    }  }  public String getLatestVerifiedBuildID() {    /*Get the latest verified build from the database in the publish server*/  }  public void clearLocalDirectory() {    /*Clear the local directory in which the downloaded build was stored*/  }}			

    延伸閱讀

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

    32/3<123>

    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(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>