{"id":7537,"library":"pyats-aetest","title":"pyATS AEtest","description":"pyATS AEtest (version 26.3) is the primary test automation engine within the Cisco pyATS framework, designed for structured and hierarchical test script development, particularly for network device testing. It provides robust features such as common setup/cleanup stages, testcase parametrization, and comprehensive result reporting. The library typically follows a monthly or bi-monthly release cadence, aligning with broader pyATS framework updates.","status":"active","version":"26.3","language":"python","source_language":"en","source_url":"https://github.com/Cisco-pyATS/pyATS.aetest","tags":["testing","network-automation","cisco","devnet"],"install":[{"cmd":"pip install pyats.aetest","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"wrong":"import pyats.aetest","symbol":"Aetest","correct":"from pyats.aetest import Aetest"},{"wrong":"import pyats.aetest","symbol":"Testcase","correct":"from pyats.aetest import Testcase"},{"wrong":"import pyats.aetest","symbol":"setup","correct":"from pyats.aetest import setup"}],"quickstart":{"code":"from pyats import aetest\n\nclass CommonSetup(aetest.CommonSetup):\n    \"\"\"Common Setup for all testcases\"\"\"\n    @aetest.subsection\n    def initial_setup(self):\n        self.parent.parameters['my_data'] = 'initialized_data'\n        self.passed('Common Setup completed')\n\nclass TestcaseOne(aetest.Testcase):\n    \"\"\"A simple testcase\"\"\"\n    @aetest.test\n    def check_data(self):\n        data = self.parent.parameters.get('my_data')\n        if data == 'initialized_data':\n            self.passed(f'Data matched: {data}')\n        else:\n            self.failed(f'Unexpected data: {data}')\n\nclass CommonCleanup(aetest.CommonCleanup):\n    \"\"\"Common Cleanup for all testcases\"\"\"\n    @aetest.subsection\n    def final_cleanup(self):\n        self.passed('Common Cleanup completed')\n\nif __name__ == '__main__':\n    # To run this script:\n    # 1. Save it as e.g., my_test.py\n    # 2. Execute: python my_test.py\n    # For advanced features like testbed parsing, use 'pyats run testbed my_test.py'\n    aetest.main()","lang":"python","description":"This quickstart demonstrates the basic structure of a pyATS AEtest script, including `CommonSetup`, `Testcase`, and `CommonCleanup` sections. It defines a simple testcase that uses data set up in the CommonSetup. The `aetest.main()` call allows the script to be executed directly."},"warnings":[{"fix":"Ensure your environment uses Python 3.8 or a later supported version. Upgrade Python if necessary or use a virtual environment with the correct Python version.","message":"pyATS AEtest officially supports Python 3.8 and newer. Attempting to use older Python versions (e.g., Python 2.7 or Python 3.7) will lead to compatibility issues and `SyntaxError` or `ImportError` messages.","severity":"breaking","affected_versions":"< 24.x"},{"fix":"Always use `from pyats import aetest` or `import pyats.aetest` in your code. Install with `pip install pyats.aetest`.","message":"The PyPI package name `pyats-aetest` uses a hyphen, but the Python package name for importing is `pyats.aetest`. A common mistake is trying to `import pyats_aetest` or `import pyats-aetest`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For full functionality, including testbed parsing and rich reporting, always run your AEtest scripts using the `pyats run testbed` command: `pyats run testbed <script.py> --testbed-file <testbed.yaml>`.","message":"Running an AEtest script directly (e.g., `python my_test.py`) will execute the tests, but it will not automatically parse a testbed YAML file or provide advanced reporting features. This can lead to `AttributeError` if your script tries to access `self.runtime.testbed` or `self.parameters['testbed']`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Prefer `self.runtime.testbed` for accessing the testbed object within your test sections, ensuring your script is executed via `pyats run testbed`.","message":"Older pyATS versions used `self.parent.parameters['testbed']` to access the testbed object. While this still works, the recommended and more robust way to access the testbed is via `self.runtime.testbed` when running with `pyats run testbed`.","severity":"deprecated","affected_versions":"Pre-24.x (still functional but less robust)"}],"env_vars":null,"search_vec":"'26.3':6 'aetest':2,4 'align':58 'autom':11,67 'bi':54 'bi-month':53 'broader':60 'cadenc':57 'cisco':15,68 'common':37 'comprehens':43 'design':18 'develop':25 'devic':29 'devnet':69 'engin':12 'featur':34 'follow':49 'framework':17,62 'hierarch':22 'librari':47 'month':51,55 'network':28,66 'network-autom':65 'parametr':41 'particular':26 'primari':9 'provid':32 'pyat':1,3,16,61 'releas':56 'report':45 'result':44 'robust':33 'script':24 'setup/cleanup':38 'stage':39 'structur':20 'test':10,23,30,64 'testcas':40 'typic':48 'updat':63 'version':5 'within':13","created_at":"2026-04-16T14:02:37.217832+00:00","updated_at":"2026-04-16T14:02:37.217832+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpvtz2f92y/venv/lib/python3.12/site-packages/pyats/aetest/__init__.py\", line 35, in <module>\n    from .main import main\n  File \"src/pyats/aetest/main.py\", line 6, in init pyats.aetest.main\n  File \"/tmp/tmpvtz2f92"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"26.5","cli_name":"","cli_version":null,"type":"library","homepage":"https://developer.cisco.com/pyats/","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/pyats-aetest/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}