CXTA is a collection of Cisco network test automation libraries built around Robot Framework. Collections from Robot Framework standard libraries, pyATS, Unicon, Genie, and more are included to provide thousands of keywords, enabling test and validation on a wide range of devices and interfaces. Support includes, but is not limited to, the following.
Robot Framework is an open and extensible automation framework used for test automation. Robot utilizes human-readable keywords leveraging a rich ecosystem of libraries and tools. Capabilities can be extended by Python libraries and user keywords created from existing lower-level keywords. This extensibility allows Robot to be integrated with other tools and environments, and makes it an ideal choice for test automation that requires interacting with different devices, technologies, and interfaces.
Here are some of the many reasons why CXTM and multiple test and validation based service offers at Cisco have chosen to leverage Robot
for test automation.
Robot Framework:
Robot Framework leverages multiple file types.
In Robot Framework, test cases are created in executable files that use the .robot extension. Robot documentation refers to these executables as "test case files". In CXTM, these files are generically referred to as "Job Files", and that's the term used throughout this lab.
Later sections will explain how your code should be formatted in Job Files.
Resource files can contain variables and higher-level user keywords. The recommended extension for Resource files is
.resource, but the .robot extension is also acceptable. Resource files are imported into the Job File by using the
Resource setting in the *** Settings ***
section of the Robot Job File as in the following example.
*** Settings ***
Library CXTA
Resource cxta.robot
*** Test Cases ***
1. MY EXAMPLE TEST CASE
Job File sections are explained in more detail below. User keywords can also be defined in the Job File itself, but it is generally recommended to use resource files to allow the keywords to be used by multiple test cases.
Variable files contain variables that can be used in the Job Files. Like user keywords, variables can also be defined within a Job File, depending on the variable scope. Variable files can be created in YAML format and imported into the Job Files much like resource files.
In CXTM, variables can be defined in variable files saved as project or test case attachments and imported into the Job Files. Or they can be stored in a parameter file that gets imported by the Job File at runtime.
The content of a Robot Job File is defined in sections, with standard section headers.
*** Settings ***
# Used for:
# 1. Importing test libraries, resource files, and variable files
# 2. Defining metadata for test suites and test cases
# 3. Defining Suite Setup and Suite Teardown procedures
*** Variables ***
# Used for:
# Defining variables that can be used elsewhere in the Job File
*** Test Cases ***
# Used for:
# Creating test cases from available keywords
*** Keywords ***
# Used for:
# Creating user keywords from existing lower-level keywords
Sections are recognized by their header, and the recommended header format is *** Settings ***
as seen in the example above. Of the sections discussed here, Settings and Test Cases, are of more importance in this lab.
The most common approach to formatting the content of Robot Job Files is to use the space separated format where pieces of the data, such as keywords and their arguments, are separated with two or more spaces. When using the space separated format, the separator between tokens is two or more spaces, or alternatively, one or more tab characters.
*** Settings ***
Documentation Example using the space separated format.
Library OperatingSystem
*** Variables ***
${MESSAGE} Hello, world!
*** Test Cases ***
My Test
[Documentation] Example test.
Log ${MESSAGE}
My Keyword ${CURDIR}
Another Test
Should Be Equal ${MESSAGE} Hello, world!
*** Keywords ***
My Keyword
[Arguments] ${path}
Directory Should Exist ${path}
Continue to the next section to add device connection details to your project.