2012-10-16 125 views
8

有誰知道如何使用REST Library for Robot Framework?圖書館在這裏可用http://code.google.com/p/robotframework-restlibrary/source/browse/trunk/RestLibrary.py。似乎沒有可用的文檔。如何在Robot Framework中使用REST庫?

我試着在機器人框架這樣的事情,但沒有響應從請求回來:

REST Test Case 
    Get https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810,-119.6822510&timestamp=1331161200&sensor=true 
    Response test 

任何想法如何使用這個庫?

+0

類似於http://stackoverflow.com/questions/21311532/how-to-make-a-post-rest-api-in-robot-framework-with – MarkHu

+0

@MarkHu看起來相關但不相似 –

回答

5

Robot Framework的REST Library自2009年以來未開發(請參閱changes)。

目前機器人框架官方頁面引用兩個HTTP級別testing libraries

  • robotframework-requests - 發展是積極的,並使用HTTP請求Python庫。

    實例應用:

    Grab Avatar Url 
         Create Session github https://api.github.com  
        ${resp}= 
        ... Get Request  github /users/jandias 
         Should Be Equal As Strings 
          ...    ${resp.status_code} 200  
         Dictionary Should Contain Key 
          ...    ${resp.json()}  avatar_url 
    
  • robotframework-httplibrary - 使用WebTest的(與livetest)Python庫...

+1

當上面的代碼運行時,出現錯誤提示'沒有找到名稱爲'創建會話'的關鍵字'。' – Rao

+0

@Rao:這似乎意味着你的機器人不能識別'Create會話'關鍵字。請注意,該示例位於_robotframework-requests_庫的用法下,並且它不是完整的測試套件。 'Create Session'關鍵字來自這個庫。在Robot下使用(不是內置)庫時,您必須**聲明**。我必須猜測你可能會跳過/忘記它。有多種方法可以做到這一點,包括其他機器人文件。 –

0

使用 '請求' 庫。 在您的RIDE工具中,打開「圖書館」&輸入「請求」並保存。 執行你的測試用例。它很適合你

相關問題