Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use REST library in Robot Framework?

Does anybody know how to use the REST Library for Robot Framework? The library is available here http://code.google.com/p/robotframework-restlibrary/source/browse/trunk/RestLibrary.py. It seems like there is no documentation available.

I tried something like this in Robot Framework but there is no response coming back from the request:

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

Any ideas how to use this library?

like image 955
finspin Avatar asked Oct 16 '12 08:10

finspin


People also ask

How do I import a custom library into robot framework?

So our custom library can be imported in the Settings section including the relative path where the file is located. Once the file is imported, you can start using the custom keywords inside your robot script.

How do I import a Python library into robot framework?

To import the Python script inside Robot, we use the keyword Library in the Robot file under settings. To call the function, we use <file_name><dot><function name> . To add keywords inside the function, we use the keyword decorator. Here, BuildIn().

Can we do API testing using robot framework?

ROBOT framework is not only for REST APIs testing, it can be used for testing GUI (using selenium library ), verify database (using database library) and there are many more libraries which can be leveraged.


1 Answers

REST Library for Robot Framework is not developed since 2009 (see changes).

Robot Framework official page references several HTTP level testing libraries, as for example:

  • robotframework-requests - Development is active and uses Requests HTTP python library.

    Example Usage:

    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 - Uses WebTest (with livetest) python library...

like image 170
José Andias Avatar answered Oct 04 '22 07:10

José Andias