RobotFramework-Zoomba

repository·master·Indexed 41 days ago

https://github.com/accruent/robotframework-zoomba

A collection of automation libraries for GUI, REST API, and SOAP API testing using the Robot Framework. It extends SeleniumLibrary, Requests, and SudsLibrary with enhanced data validation and simplified keywords, including the GUILibrary for web automation and APILibrary for streamlined API calls and JSON response validation.

Tokens
6.1K
Snippets
19
Records
35
Agent score
99%

What's inside RobotFramework-Zoomba

  1. Use Zoomba API Library for requests and validation

    master

    The APILibrary wraps the requests library to allow making API calls and validating responses in a streamlined way.

    Making Requests

    Use Call Get Request or Call Post Request to execute calls in a single keyword:

    • Call Get Request ${headers_dictionary} ${endpoint} ${query_string}
    • Call Post Request ${headers_dictionary} ${endpoint} ${query_string} ${data_payload}

    Validating Responses

    Use Validate Response Contains Expected Response to compare an actual JSON response against an expected JSON structure. This keyword provides detailed line-by-line error reporting if mismatches are found.

    You can ignore specific keys (like timestamps or IDs) using the ignored_keys argument.

    # Making a request
    Call Post Request      ${headers_dictionary}    endpoint    query_string     ${data_payload}
    
    # Validating the response
    Validate Response Contains Expected Response    ${json_actual_response}      ${json_expected_response}
    
    # Validating while ignoring specific keys
    Validate Response Contains Expected Response    ${json_actual_response}      ${json_expected_response}      ignored_keys=update_date
    Validate Response Contains Expected Response    ${json_actual_response}      ${json_expected_response}      ignored_keys=${list_of_keys}
  2. Install RobotFramework-Zoomba

    master

    You can install RobotFramework-Zoomba and its dependencies via PyPI using pip.

    If you are developing locally or contributing to the repository, you can install it from the root directory using pip install .. To include testing dependencies, use the [testing] extra.

    # Standard installation
    pip install robotframework-zoomba
    
    # Local installation from source
    pip install .
    
    # Local installation with testing dependencies
    pip install .[testing]
  3. Import Zoomba libraries into Robot Framework

    master

    To use the Zoomba keywords in your Robot Framework test suites, import the specific library you need in the *** Settings *** section of your .robot file.

    Available libraries:

    • Zoomba.APILibrary for REST API automation.
    • Zoomba.GUILibrary for Web GUI automation.
    • Zoomba.SOAPLibrary for SOAP API automation.
    *** Settings ***
    Library    Zoomba.APILibrary
    Library    Zoomba.GUILibrary
    Library    Zoomba.SOAPLibrary
  4. Use Zoomba GUI Library keywords

    master

    The GUILibrary extends SeleniumLibrary by providing combined keywords that handle waiting and interaction in a single step, reducing boilerplate code for handling varying page load times.

    Key combined keywords:

    • Wait For And Click Element locator
    • Wait For And Click Text text
    • Wait For Select From List list_locator target_locator

    You can also use Wait Until Javascript Is Complete to ensure JavaScript execution is finished before performing subsequent actions.

    # Example of combined wait-and-click
    Wait For And Click Element      locator
    
    # Example of waiting for JS completion
    Wait For And Click Element       locator that leads to a new page with javascript     
    Wait Until Javascript Is Complete
    Wait For And Click Element       locator
  5. Initialize GUILibrary

    master

    The GUILibrary class inherits from SeleniumLibrary and provides expanded keywords for web automation. It can be initialized with several configuration arguments:

    • timeout: Default value for Wait ... keywords.
    • implicit_wait: Default value for implicit wait used when locating elements.
    • run_on_failure: Default action for the run-on-failure functionality.
    • screenshot_root_directory: Path where screenshots are created. If set to EMBED, screenshots are embedded into the Robot Framework report. If not provided, the directory of the log file is used.
    • plugins: Allows extending the library with external Python classes.
    • event_firing_webdriver: Class for wrapping Selenium with EventFiringWebDriver.
  6. Debug React Select drop-downs

    master

    When automating or debugging React Select components, note that the menu <div> (e.g., with a class like css-26l3qy-menu) only exists in the DOM when the drop-down is expanded. If you attempt to inspect the menu using browser developer tools, the menu may collapse, causing the elements to disappear from the DOM tree.

    To successfully interact with or inspect the menu, you must ensure the component is in its expanded state. When expanded, the container will include the css-26l3qy-menu element containing the available options.

  7. Migrate from MobileLibrary to Robotframework-ApplicationLibrary

    master

    The MobileLibrary class in robotframework-zoomba is deprecated. As of version 3.0.0, all mobile automation functionality has been moved to the Robotframework-ApplicationLibrary. Users should migrate their Robot Framework suites to use the new library to ensure continued support and access to mobile automation features.

    For migration details and release notes, refer to the version 3.0.0 release notes.

  8. Create a SOAP session

    master

    Use create_soap_session to initialize a SOAP client using a WSDL. You can provide a host and endpoint to construct the WSDL URL. You can also provide an alias to manage multiple sessions via the underlying SudsLibrary.

    If you need to override the WSDL location with a specific HTTP address, use the set_location keyword argument.

    Create Soap Session    host=http://api.example.com    endpoint=/service    alias=MyService    set_location=http://new-location.com
  9. Fix broken WSDL namespaces during session creation

    master

    If your WSDL has broken namespaces (e.g., missing tns or targetNamespace definitions), use create_soap_session_and_fix_wsdl. This keyword utilizes an internal _ObjectNamespacePlugin to automatically inject the correct namespaces and prefix types with tns: during the client construction process.

    Create Soap Session And Fix Wsdl    host=http://api.example.com    endpoint=/service
  10. Understand and use ZoombaError for custom failures

    master

    The ZoombaError class is used to capture and format detailed error information within Zoomba libraries. It allows you to store specific context about a failure—such as the key being inspected, the expected value, and the actual value received—and then report it to the Robot Framework via the .fail() method.

    When calling .fail(), the error is formatted into a readable string that highlights the important attribute (which defaults to 'key') with a separator line, making it easier to debug in Robot Framework logs.

    from Zoomba.ZoombaError import ZoombaError
    
    # Example of creating a detailed error
    error = ZoombaError(
        error="Value mismatch",
        key="username",
        expected="admin",
        actual="guest"
    )
    
    # Report the error to Robot Framework
    error.fail()