Devnet
NetDevOps
Pyats Testing Automation

Continuous Integration (CI) and Automated Testing

Continuous Integration (CI) involves developers frequently merging code changes into a shared repository, accompanied by automated testing to detect errors and conflicts early on. Automated testing plays a pivotal role in this process, ensuring quick and efficient error identification.

Types of Automated Tests

Automated tests vary in scope, from unit tests examining individual code components to end-to-end tests simulating real-world scenarios. The choice of test type depends on the software's nature and associated risks.

Test TypeDescription
Unit TestsAssess individual classes or functions, offering quick execution for frequent use.
End-to-End TestsProvide comprehensive system overview, albeit with longer execution times.

In Infrastructure as Code (IaC) scenarios, while unit testing remains relevant, end-to-end tests gain prominence due to the need to validate multiple systems against configuration deployments.

Python Automated Test Systems (pyATS)

Python Automated Test Systems (pyATS) serves as a Python3-based test automation infrastructure, designed to streamline testing in NetDevOps environments. Originally utilized internally by Cisco, pyATS now offers a comprehensive suite of features, making it suitable for CI testing within the CI/CD pipeline.

Features of pyATS

  • Foundational Platform: Original pyATS framework forming the base.
  • Library System: Open-source, platform-agnostic library system known as pyATS Library (formerly Genie).
  • Web Dashboard (XPRESSO): Manages test suites, testbeds, results, and insights.
  • Extensible Layers: Built like Lego blocks, facilitating customization and integration with other frameworks.

pyATS Testbed

The pyATS testbed file, typically in YAML format, contains crucial information about devices, connections, credentials, etc. It serves as a blueprint for test executions and can be manually created or derived from various sources.

Testcases and Triggers

  • Testcases: Containers for smaller tests assessing product quality, often with setup and cleanup sections. While not reusable, they form the core of test scripts.
  • Triggers: Independent pyATS testcases not tied to specific scripts, facilitating test reuse and modularization. They offer a Lego-block-like approach for building testcases.

pyATS Automation Easy Testing (AEtest)

AEtest provides a simple and structured approach for defining, executing, and debugging testcases and scripts. Leveraging Python's object-oriented capabilities, AEtest offers a Pythonic user experience with modular and extensible design features.

Key Features of AEtest

  • Object-oriented design for a Pythonic user experience.
  • Block-based breakdown of test sections.
  • Modular and extensible architecture.
  • Customizable reporter and enhanced looping capabilities.

The structured nature of AEtest ensures scalability and readability in generating test results and logs, making it an ideal choice for CI testing in NetDevOps environments.