qaf-python


Nameqaf-python JSON
Version 1.0.0b0 PyPI version JSON
download
home_pagehttps://github.com/qmetry/qaf-python
SummaryThis is Automation framework for Python developed by Infostretch
upload_time2023-07-14 15:36:22
maintainer
docs_urlNone
authorNishith Shah, Chirag Jayswal
requires_python>=3.6
licenseMIT
keywords qaf bdd automation python-selenium python-automation appium python-appium
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # QAF-Python Automation Framework #

The QAF-Python Automation Framework is designed to facilitate functional test automation for various platforms,
including Web, Mobile Web, Mobile Hybrid apps, Mobile Native apps, and web services. It offers a comprehensive set of
features for driver and resource management, data-driven testing, and BDD support using QAF BDD2. The framework is built
on Python 3.x and seamlessly integrates with popular tools like pytest, WebDriver, and Appium.

## Installation

    pip install git+https://github.com/qmetry/qaf-python.git@master

## Run Test

    pytest [<options>]

## Quick Example

Steps file: `proj/steps/commonsteps.py`

```python
from qaf.automation.bdd2 import *
from qaf.automation.step_def.common_steps import *


@step("user is on application home")
def open_app():
    get("/")


@step("login with {username} and {password}")
def login(username, password):
    sendKeys("username.txt.ele", username)
    sendKeys("password.txt.ele", password)
    click("login.btn.ele")
```

You have the flexibility to write your tests using **either** Python as pytest **or** in a behavior-driven development (
BDD)
style. This allows you to choose the approach that best suits your preferences and project requirements.

### Testcase authoring in BDD

BDD file: `features/login.feature`

```gherkin
@web @mobile
@storyKey:PRJ001 @module:login
Feature: Login functionality

  @smoke
  @testCaseId:TC001
  Scenario: user should be able to login into application
    Given user is on application home
    When login with '${valid.user.name}' and '${valid user.password}'
    Then verify 'logout.btn.ele' is present

  @datafile:resources/${env.name}/logindata.csv
  Scenario: user should be able to login into application
    Given user is on application home
    When login with '${user-name}' and '${password}'
    Then verify 'error.text.ele' text is '${error-msg}'
```

#### Run tests

You can run BDD same as running normal pytest

```python
pytest features  # all files from features directory 
pytest features/login.feature  # single file
pytest features --dryrun  # dry-run mode
```

you can use pytest mark or qaf metadata filter.

```python
pytest
features -m web --metadata-filter "module == 'login' and storyKey in ['PRJ001', 'PRJ005']"
```

### Test case authoring in python script (pytest)

```python
from qaf.automation.step_def.common_steps import verify_present, verify_text
from proj.steps.commonsteps import *


@pytest.mark.web
@pytest.mark.mobile
@metadata(storyKey="TC001", module="login")
class loginFunctionality:
    @metadata("smoke", testCaseId="TC001")
    def test_login():
        open_app()
        login(getBundle().get_string('valid.user.name'), getBundle().get_string('valid.user.password'))
        verify_present(None, 'logout.btn.ele')

    @dataprovider(datafile="resources/${env.name}/logindata.csv")
    def test_login(testdata):
        open_app()
        login(testdata.get('user-name'), testdata.get('password'))
        verify_text(None, 'error.text.ele', testdata.get('error-msg'))
```

#### run test

same as running normal pytest with additional meta-data filter as shown in example above

## Features

Here is list of features in addition to features supported by pytest

- **Web, Mobile, and Web Services Testing**: The framework supports test automation for Web applications, Mobile Web,
  Mobile Hybrid apps, Mobile Native apps, and web services. It provides a unified solution for testing different
  platforms.

- **Configuration Management**: The framework offers robust configuration management capabilities. It supports various
  configuration file formats such as `ini`, `properties`, `wsc`, `loc`, `locj`, and `wscj`. This allows you to manage and organize
  your test configuration efficiently.

- **Driver Management**: The framework simplifies the management of WebDriver and Appium drivers. It supports on-demand
  driver session creation and automatic teardown, making it easy to without worring of set up and clean up driver
  sessions. You can configure the driver properties through properties files, enabling flexibility in driver
  configuration.

- **Driver and Element Command Listeners**: The framework allows you to register driver command listeners and element
  command listeners. This feature enables you to intercept and modify driver and element commands, facilitating custom
  behavior and extensions.

- **Support for Multiple Driver Sessions**: QAF-Python supports multiple driver sessions in the same test. This means
  you can test scenarios that involve multiple browser instances or multiple mobile devices simultaneously.

- **Wait/Assert/Verify Functionality**: The framework provides convenient methods for waiting, asserting, and verifying
  element states. It includes automatic waiting capabilities, ensuring synchronization between test steps and
  application behavior.

- **Locator Repository**: QAF-Python includes a locator repository for managing web and mobile element locators. The
  repository allows you to store and organize element locators, making them easily accessible and reusable across tests.

- **Request Call Repository**: For testing web services, the framework provides a repository for managing web service
  request calls. You can store and manage your API requests, making it convenient to handle different API scenarios and
  payloads.

- **Data-Driven Testing**: QAF-Python supports data-driven testing by integrating with CSV and JSON data files. You can
  parameterize your tests and iterate over test data, enabling you to run tests with different input values and expected
  results.

- **Native Pytest Implementation of QAF-BDD2**: The framework offers a native implementation of QAF-BDD2 in pytest. This
  allows you to write BDD-style tests using the Given-When-Then syntax and organize them into feature files. You can use
  metadata annotations and tags to categorize and filter tests based on criteria such as story key, module, and more.

- **Step Listener with Retry Step Capability**: QAF-Python includes a step listener that provides retry capabilities for
  test steps. If a step fails, the framework can automatically retry the step for a specified number of times, enhancing
  the robustness of your tests.

- **Dry Run Support**: You can perform a dry run of your tests using the framework. This allows you to check the test
  execution flow, identify any errors or issues, and ensure that the tests are set up correctly before running them for
  real.

- **Metadata Support with Metadata Filter**: QAF-Python supports metadata annotations and filters. You can assign
  metadata to tests, such as story key, module, or custom tags, and use metadata filters to selectively run tests based
  on specific criteria.

- **Detailed Reporting**: The framework provides detailed reporting capabilities, giving you insights into test
  execution results. You can generate comprehensive reports that include test status, step-level details, screenshots,
  and other relevant information.

- **Repository Editor**: QAF offers a repository editor tool that allows you to create and update the locator
  repository and request call repository easily. The editor provides a user-friendly interface for managing and
  organizing your locators and API requests. You can
  use [repository editor](https://qmetry.github.io/qaf/latest/repo_editor.html) to create/update locator
  repository and request call repository.

**Driver Management benefits**

The framework simplifies the management of WebDriver and Appium drivers. It supports on-demand driver session creation
and automatic teardown, making it easy to set up and clean up driver sessions. This feature allows you to focus on
writing test scripts rather than dealing with driver setup and cleanup processes.

- **On-Demand Driver Session Creation**: With the framework's on-demand driver session creation, framework dynamically
  creates driver instances whenever you need them during test execution. This ensures that the drivers are available
  precisely when required, reducing resource wastage and enhancing test execution efficiency.

- **Automatic Teardown**: After test execution or when a test session ends, the framework automatically tears down the
  driver sessions. This cleanup process prevents any potential resource leaks and optimizes the utilization of testing
  resources.

- **Driver Configuration via Properties Files**: The framework allows you to configure driver through properties files.
  This approach provides a convenient and organized way to manage various driver settings, such as browser preferences,
  timeouts, and capabilities, in separate configuration files. It makes the driver configuration process more manageable
  and less error-prone.

- **Flexibility in Driver Configuration**: By using properties files for driver configuration, you gain flexibility in
  customizing the driver behavior. You can easily update the properties files to modify driver settings without
  modifying the test scripts, which enhances maintainability and reusability of your automation code.

The Driver Management feature in the framework streamlines the process of working with WebDriver and Appium drivers. It
ensures that driver sessions are readily available when needed and automatically handles cleanup after test execution.
Additionally, the flexibility in driver configuration through properties files simplifies the management of driver
settings, improving the overall efficiency and organization of your test automation process.

## Properties used by framework

 Key                            | Usage                                                                                                                                                            
--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------
 selenium.wait.timeout          | Default wait time to be used by framework by wait/assert/verify methods                                                                                          
 remote.server                  | Remote server url, which will be considered if configured remote driver. e.g. http://localhost:, localhost, 127.0.0.1, etc..                                     
 remote.port                    | Remote server port, which will be considered if configured remote driver                                                                                         
 driver.name                    | Driver to be used, for instance firefoxDriver or firefoxRemoteDriver etc..                                                                                       
 driver.capabilities            | Specify additional capability by name with this prefix that can applicable for any driver.                                                                       
 driver.additional.capabilities | Specify multiple additional capabilities as map that can applicable for any driver                                                                               
 {0}.additional.capabilities    | Specify multiple additional capabilities as map that can applicable for specific driver. For example, chrome.additional.capabilities.                            
 {0}.capabilities               | Specify additional capability by name with this prefix that can applicable for specific driver. For example, chrome.capabilities.                                
 env.baseurl                    | Base URL of AUT to be used.                                                                                                                                      
 env.resources                  | File or directory to load driver specific resources, for instance driver specific locators.                                                                      
 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.   
 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. 
 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.                 
 env.default.locale             | Local name from loaded locals that need to treated as default local                                                                                              
 testing.approach               | e.g. behave, pytest                                                                                                                                              

### License

This project is licensed under the MIT License.

### Acknowledgements

We would like to thank the pytest community for their excellent work in developing a robust and extensible testing
framework. Their contributions have been invaluable in building this enhanced test automation framework.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/qmetry/qaf-python",
    "name": "qaf-python",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "nishith.shah@infostretch.com",
    "keywords": "qaf,bdd,automation,python-selenium,python-automation,appium,python-appium",
    "author": "Nishith Shah, Chirag Jayswal",
    "author_email": "nishith.shah@infostretch.com",
    "download_url": "https://files.pythonhosted.org/packages/ce/00/770ecf0c70e33733950082629b56d5935eaff6459202ded881b7d43b1fc8/qaf-python-1.0.0b0.tar.gz",
    "platform": null,
    "description": "# 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 [<options>]\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.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This is Automation framework for Python developed by Infostretch",
    "version": "1.0.0b0",
    "project_urls": {
        "Homepage": "https://github.com/qmetry/qaf-python"
    },
    "split_keywords": [
        "qaf",
        "bdd",
        "automation",
        "python-selenium",
        "python-automation",
        "appium",
        "python-appium"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2953a01b166bd00513d9471026432b5052eef1847a148ee62a041fe400c516d8",
                "md5": "757afe00a667ff78ca8ef4ffab8b2afc",
                "sha256": "43a508ad89015748d9a49fc618389d2cd5dc56edff0341182d54e1f7fab07d5e"
            },
            "downloads": -1,
            "filename": "qaf_python-1.0.0b0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "757afe00a667ff78ca8ef4ffab8b2afc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 115826,
            "upload_time": "2023-07-14T15:36:20",
            "upload_time_iso_8601": "2023-07-14T15:36:20.676703Z",
            "url": "https://files.pythonhosted.org/packages/29/53/a01b166bd00513d9471026432b5052eef1847a148ee62a041fe400c516d8/qaf_python-1.0.0b0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce00770ecf0c70e33733950082629b56d5935eaff6459202ded881b7d43b1fc8",
                "md5": "35461430b301a9b2e01dc4fa4c86b3a1",
                "sha256": "f6c970664ab42be095604b9ae4b2871b2732a7a589a2d48e60d8e088f7f307a5"
            },
            "downloads": -1,
            "filename": "qaf-python-1.0.0b0.tar.gz",
            "has_sig": false,
            "md5_digest": "35461430b301a9b2e01dc4fa4c86b3a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 67247,
            "upload_time": "2023-07-14T15:36:22",
            "upload_time_iso_8601": "2023-07-14T15:36:22.524140Z",
            "url": "https://files.pythonhosted.org/packages/ce/00/770ecf0c70e33733950082629b56d5935eaff6459202ded881b7d43b1fc8/qaf-python-1.0.0b0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-14 15:36:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "qmetry",
    "github_project": "qaf-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "qaf-python"
}
        
Elapsed time: 0.10122s