{"id":21375672,"url":"https://github.com/qaf-tm/qaf-python","last_synced_at":"2025-07-13T09:33:34.259Z","repository":{"id":38459390,"uuid":"483745455","full_name":"qmetry/qaf-python","owner":"qmetry","description":"python version of qaf for web, mobile and webservices test automation","archived":false,"fork":false,"pushed_at":"2024-02-04T02:56:14.000Z","size":421,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-11T15:08:22.037Z","etag":null,"topics":["bdd","bdd2","e2e","mobile-automation","pytest","python","qaf","selenium","testing","web-automation","webdriver","webservices-automation"],"latest_commit_sha":null,"homepage":"https://qmetry.github.io/qaf/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qmetry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-04-20T17:12:47.000Z","updated_at":"2024-04-10T00:33:25.000Z","dependencies_parsed_at":"2023-10-14T23:30:19.267Z","dependency_job_id":null,"html_url":"https://github.com/qmetry/qaf-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qmetry%2Fqaf-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qmetry%2Fqaf-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qmetry%2Fqaf-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qmetry%2Fqaf-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qmetry","download_url":"https://codeload.github.com/qmetry/qaf-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225871094,"owners_count":17537173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdd","bdd2","e2e","mobile-automation","pytest","python","qaf","selenium","testing","web-automation","webdriver","webservices-automation"],"created_at":"2024-11-22T09:12:00.061Z","updated_at":"2025-07-13T09:33:28.959Z","avatar_url":"https://github.com/qmetry.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QAF-Python Automation Framework #\n\nThe QAF-Python Automation Framework is designed to facilitate functional test automation for various platforms,\nincluding Web, Mobile Web, Mobile Hybrid apps, Mobile Native apps, and web services. It offers a comprehensive set of\nfeatures for driver and resource management, data-driven testing, and BDD support using QAF BDD2. The framework is built\non Python 3.x and seamlessly integrates with popular tools like pytest, WebDriver, and Appium.\n\n## Installation\n\n    pip install git+https://github.com/qmetry/qaf-python.git@master\n\n## Run Test\n\n    pytest [\u003coptions\u003e]\n\n## Quick Example\n\nSteps file: `proj/steps/commonsteps.py`\n\n```python\nfrom qaf.automation.bdd2 import *\nfrom qaf.automation.step_def.common_steps import *\n\n\n@step(\"user is on application home\")\ndef open_app():\n    get(\"/\")\n\n\n@step(\"login with {username} and {password}\")\ndef login(username, password):\n    sendKeys(\"username.txt.ele\", username)\n    sendKeys(\"password.txt.ele\", password)\n    click(\"login.btn.ele\")\n```\n\nYou have the flexibility to write your tests using **either** Python as pytest **or** in a behavior-driven development (\nBDD)\nstyle. This allows you to choose the approach that best suits your preferences and project requirements.\n\n### Testcase authoring in BDD\n\nBDD file: `features/login.feature`\n\n```gherkin\n@web @mobile\n@storyKey:PRJ001 @module:login\nFeature: Login functionality\n\n  @smoke\n  @testCaseId:TC001\n  Scenario: user should be able to login into application\n    Given user is on application home\n    When login with '${valid.user.name}' and '${valid user.password}'\n    Then verify 'logout.btn.ele' is present\n\n  @datafile:resources/${env.name}/logindata.csv\n  Scenario: user should be able to login into application\n    Given user is on application home\n    When login with '${user-name}' and '${password}'\n    Then verify 'error.text.ele' text is '${error-msg}'\n```\n\n#### Run tests\n\nYou can run BDD same as running normal pytest\n\n```python\npytest features  # all files from features directory \npytest features/login.feature  # single file\npytest features --dryrun  # dry-run mode\n```\n\nyou can use pytest mark or qaf metadata filter.\n\n```python\npytest\nfeatures -m web --metadata-filter \"module == 'login' and storyKey in ['PRJ001', 'PRJ005']\"\n```\n\n### Test case authoring in python script (pytest)\n\n```python\nfrom qaf.automation.step_def.common_steps import verify_present, verify_text\nfrom proj.steps.commonsteps import *\n\n\n@pytest.mark.web\n@pytest.mark.mobile\n@metadata(storyKey=\"TC001\", module=\"login\")\nclass loginFunctionality:\n    @metadata(\"smoke\", testCaseId=\"TC001\")\n    def test_login():\n        open_app()\n        login(getBundle().get_string('valid.user.name'), getBundle().get_string('valid.user.password'))\n        verify_present(None, 'logout.btn.ele')\n\n    @dataprovider(datafile=\"resources/${env.name}/logindata.csv\")\n    def test_login(testdata):\n        open_app()\n        login(testdata.get('user-name'), testdata.get('password'))\n        verify_text(None, 'error.text.ele', testdata.get('error-msg'))\n```\n\n#### run test\n\nsame as running normal pytest with additional meta-data filter as shown in example above\n\n## Features\n\nHere is list of features in addition to features supported by pytest\n\n- **Web, Mobile, and Web Services Testing**: The framework supports test automation for Web applications, Mobile Web,\n  Mobile Hybrid apps, Mobile Native apps, and web services. It provides a unified solution for testing different\n  platforms.\n\n- **Configuration Management**: The framework offers robust configuration management capabilities. It supports various\n  configuration file formats such as `ini`, `properties`, `wsc`, `loc`, `locj`, and `wscj`. This allows you to manage and organize\n  your test configuration efficiently.\n\n- **Driver Management**: The framework simplifies the management of WebDriver and Appium drivers. It supports on-demand\n  driver session creation and automatic teardown, making it easy to without worring of set up and clean up driver\n  sessions. You can configure the driver properties through properties files, enabling flexibility in driver\n  configuration.\n\n- **Driver and Element Command Listeners**: The framework allows you to register driver command listeners and element\n  command listeners. This feature enables you to intercept and modify driver and element commands, facilitating custom\n  behavior and extensions.\n\n- **Support for Multiple Driver Sessions**: QAF-Python supports multiple driver sessions in the same test. This means\n  you can test scenarios that involve multiple browser instances or multiple mobile devices simultaneously.\n\n- **Wait/Assert/Verify Functionality**: The framework provides convenient methods for waiting, asserting, and verifying\n  element states. It includes automatic waiting capabilities, ensuring synchronization between test steps and\n  application behavior.\n\n- **Locator Repository**: QAF-Python includes a locator repository for managing web and mobile element locators. The\n  repository allows you to store and organize element locators, making them easily accessible and reusable across tests.\n\n- **Request Call Repository**: For testing web services, the framework provides a repository for managing web service\n  request calls. You can store and manage your API requests, making it convenient to handle different API scenarios and\n  payloads.\n\n- **Data-Driven Testing**: QAF-Python supports data-driven testing by integrating with CSV and JSON data files. You can\n  parameterize your tests and iterate over test data, enabling you to run tests with different input values and expected\n  results.\n\n- **Native Pytest Implementation of QAF-BDD2**: The framework offers a native implementation of QAF-BDD2 in pytest. This\n  allows you to write BDD-style tests using the Given-When-Then syntax and organize them into feature files. You can use\n  metadata annotations and tags to categorize and filter tests based on criteria such as story key, module, and more.\n\n- **Step Listener with Retry Step Capability**: QAF-Python includes a step listener that provides retry capabilities for\n  test steps. If a step fails, the framework can automatically retry the step for a specified number of times, enhancing\n  the robustness of your tests.\n\n- **Dry Run Support**: You can perform a dry run of your tests using the framework. This allows you to check the test\n  execution flow, identify any errors or issues, and ensure that the tests are set up correctly before running them for\n  real.\n\n- **Metadata Support with Metadata Filter**: QAF-Python supports metadata annotations and filters. You can assign\n  metadata to tests, such as story key, module, or custom tags, and use metadata filters to selectively run tests based\n  on specific criteria.\n\n- **Detailed Reporting**: The framework provides detailed reporting capabilities, giving you insights into test\n  execution results. You can generate comprehensive reports that include test status, step-level details, screenshots,\n  and other relevant information.\n\n- **Repository Editor**: QAF offers a repository editor tool that allows you to create and update the locator\n  repository and request call repository easily. The editor provides a user-friendly interface for managing and\n  organizing your locators and API requests. You can\n  use [repository editor](https://qmetry.github.io/qaf/latest/repo_editor.html) to create/update locator\n  repository and request call repository.\n\n**Driver Management benefits**\n\nThe framework simplifies the management of WebDriver and Appium drivers. It supports on-demand driver session creation\nand automatic teardown, making it easy to set up and clean up driver sessions. This feature allows you to focus on\nwriting test scripts rather than dealing with driver setup and cleanup processes.\n\n- **On-Demand Driver Session Creation**: With the framework's on-demand driver session creation, framework dynamically\n  creates driver instances whenever you need them during test execution. This ensures that the drivers are available\n  precisely when required, reducing resource wastage and enhancing test execution efficiency.\n\n- **Automatic Teardown**: After test execution or when a test session ends, the framework automatically tears down the\n  driver sessions. This cleanup process prevents any potential resource leaks and optimizes the utilization of testing\n  resources.\n\n- **Driver Configuration via Properties Files**: The framework allows you to configure driver through properties files.\n  This approach provides a convenient and organized way to manage various driver settings, such as browser preferences,\n  timeouts, and capabilities, in separate configuration files. It makes the driver configuration process more manageable\n  and less error-prone.\n\n- **Flexibility in Driver Configuration**: By using properties files for driver configuration, you gain flexibility in\n  customizing the driver behavior. You can easily update the properties files to modify driver settings without\n  modifying the test scripts, which enhances maintainability and reusability of your automation code.\n\nThe Driver Management feature in the framework streamlines the process of working with WebDriver and Appium drivers. It\nensures that driver sessions are readily available when needed and automatically handles cleanup after test execution.\nAdditionally, the flexibility in driver configuration through properties files simplifies the management of driver\nsettings, improving the overall efficiency and organization of your test automation process.\n\n## Properties used by framework\n\n Key                            | Usage                                                                                                                                                            \n--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------\n selenium.wait.timeout          | Default wait time to be used by framework by wait/assert/verify methods                                                                                          \n remote.server                  | Remote server url, which will be considered if configured remote driver. e.g. http://localhost:, localhost, 127.0.0.1, etc..                                     \n remote.port                    | Remote server port, which will be considered if configured remote driver                                                                                         \n driver.name                    | Driver to be used, for instance firefoxDriver or firefoxRemoteDriver etc..                                                                                       \n driver.capabilities            | Specify additional capability by name with this prefix that can applicable for any driver.                                                                       \n driver.additional.capabilities | Specify multiple additional capabilities as map that can applicable for any driver                                                                               \n {0}.additional.capabilities    | Specify multiple additional capabilities as map that can applicable for specific driver. For example, chrome.additional.capabilities.                            \n {0}.capabilities               | Specify additional capability by name with this prefix that can applicable for specific driver. For example, chrome.capabilities.                                \n env.baseurl                    | Base URL of AUT to be used.                                                                                                                                      \n env.resources                  | File or directory to load driver specific resources, for instance driver specific locators.                                                                      \n wd.command.listeners           | List of web driver command listeners (fully qualified class name that abstract qaf.automation.ui.webdriver.abstract_listener.DriverListener) to be registered.   \n we.command.listeners           | List of web element command listeners (fully qualified class name that abstract qaf.automation.ui.webdriver.abstract_listener.ElementListener) to be registered. \n ws.command.listeners           | List of web service command listeners (fully qualified class name that abstract qaf.automation.ws.rest.ws_listener.WsListener) to be registered.                 \n env.default.locale             | Local name from loaded locals that need to treated as default local                                                                                              \n testing.approach               | e.g. behave, pytest                                                                                                                                              \n\n### License\n\nThis project is licensed under the MIT License.\n\n### Acknowledgements\n\nWe would like to thank the pytest community for their excellent work in developing a robust and extensible testing\nframework. Their contributions have been invaluable in building this enhanced test automation framework.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqaf-tm%2Fqaf-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqaf-tm%2Fqaf-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqaf-tm%2Fqaf-python/lists"}