Asserting request result

The simplest way is to check HTTP status code

  • Update 'google-request.robot'
*** Settings ***
Library    RequestsLibrary

*** Test Case ***
Simple request google page
    Create Session    google    https://www.google.co.th
    ${response}=    Get Request    google    /
    Should Be Equal As Strings    200    ${response.status_code}
  • Execute and see result
==============================================================================
Google-Request
==============================================================================
Simple request google page                                            ./usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
Simple request google page                                            | PASS |
------------------------------------------------------------------------------
Google-Request                                                        | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================

results matching ""

    No results matching ""