使用RobotFramework的DataBaseLibrary(Java實現)

來源:互聯網
上載者:User

標籤:

RobotFramework能用Python和Jython兩條腿走路。但有的時候你得選一條。今天就碰上個問題,為了整合其它模組必須用Java實現的DataBaseLibrary

其實實它很簡單,記錄步驟如下: 1.在RF的首頁找到DataBaseLibrary(Java)的首頁。http://code.google.com/p/robotframework-dblibrary/下載dblibrary-1.0.jar 這個庫檔案 2.在Oracle的首頁的download中找到JDBC的驅動程式下載下來(不同版本驅動不同,我用的10g的驅動class12.jar),或者從你安裝的Oracle目錄的jdbc子目錄中找到驅動備用。 3.將這兩個jar檔案全部加入環境變數CLASSPATH 4.在RF裡編寫測試指令碼 串連的例子如下:  Database
Setting Value
Library org.robot.database.keywords.DatabaseLibrary      
         
Test Case Action Arguments
Test Connect to DataBase oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:sid username
  ... password    
         
具體使用方式可見使用者手冊:http://robotframework-dblibrary.googlecode.com/svn/tags/robotframework-dblibrary-1.0/doc/DatabaseLibrary.html 兩個Tip:1.為了便於多人使用,建議使用bat動態在Classpath加入Jar包。而不是直接寫到環境變數中(這樣慢慢的你的classpath就亂死了)。給一個參考例子: set CP=%CLASSPATH%for %%j in (*.jar) do ( call :set_cp %%j )set CLASSPATH=%CP% jybot --outputdir ?%   --suitestatlevel 1 %* goto :eof :set_cpset CP=%CP%?%\%1;goto :eof 2.這個classLibrary是開源的,寫的很粗糙,覺得不爽可以自己改一改,它的代碼host在google code上可用SVN checkouthttp://code.google.com/p/robotframework-dblibrary/source/checkout

使用RobotFramework的DataBaseLibrary(Java實現)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.