UserPyModules.CustomChecks package

Subpackages

Submodules

UserPyModules.CustomChecks.CheckPackageAttributes module

class UserPyModules.CustomChecks.CheckPackageAttributes.CheckPackageAttributes(internalApi)

Bases: AbstractPackageCheck

Check Package Attributes

Description

Checks whether all package attributes are set according to YAML config.

Specifics and Results

Instructions:

Specify the attributes to be checked in the YAML configuration file according to the following pattern. Three types of checks are possible

  1. Check if a value should exist for a specific attribute or if attributes should be left empty:

    <attribute name>: True, False

  2. Check if a selected attribute value is in a list of allowed choices:
    <attribute name>:

    [<choice one>, <choice two>, …]

  3. Check if an attribute matches a specific pattern
    <attribute name>:

    “RegexPattern”: <your pattern> (“RegexDescription”: <description for error print>) optional

Return messages:

  • “<attribute name> must not be empty”

  • “<attribute name> must not be set”

  • “<attribute name> no valid option out of: <attributes options>”

  • <attribute name> must not be empty! <CustomMessage>

  • <attribute name> must not be empty! Intended pattern: <RegexPattern>

  • <attribute name> must not be empty! Allowed options: <list>

  • <attribute name> does not match pattern. <CustomMessage>

  • <attribute name> does not match pattern: <RegexPattern>

  • “No field: ‘RegexPattern’ was provided!”

  • “<Provided pattern> is not a valid pattern!”

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List

Needs to be implemented in the custom check (template method)

Parameters
test_item: item from Object API

generic test item; Package, Project or AnalysisPackage

parameters: any

the Parameters entry from config.yaml

Returns

list of CheckResult (empty if no violation was found)

UserPyModules.CustomChecks.CheckPackageContentAllowed module

class UserPyModules.CustomChecks.CheckPackageContentAllowed.CheckPackageContentAllowed(internalApi)

Bases: AbstractPackageCheck

Check Package for allowed test steps

Description

Checks whether the target package only consists of the specified test steps in the configured package layers.

Instructions:

to configure this test in the config.yaml, add allowed TestStep-Types in AllowList Parameter and the considered SearchDepth, if no SearchDepth is configured, all package layers are checked.

Return messages:

  • “Not allowed content of type <ts_type> in line <ts_line>!”

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List

Needs to be implemented in the custom check (template method)

Parameters
test_item: item from Object API

generic test item; Package, Project or AnalysisPackage

parameters: any

the Parameters entry from config.yaml

Returns

list of CheckResult (empty if no violation was found)

check_test_step(test_step, layer, allow_list, search_depth) None

Check if the test step is allowed by the defined allow list; checks child test steps recursively as well for the given search depth

Parameters
test_step: TestStep object

the test step item

layer: int

the current package layer

allow_list: List[str]

allowed test step types

search_depth: int

the search depth

Returns

None

get_test_steps_of_item(item) List

Gets the test steps of the target item

Parameters
item: Package object or TestStep object

tha package or test step item

Returns

test step items

UserPyModules.CustomChecks.CheckPackageContentForbidden module

class UserPyModules.CustomChecks.CheckPackageContentForbidden.CheckPackageContentForbidden(internalApi)

Bases: AbstractPackageCheck

Check Package Content

Description

Checks whether the package has forbidden content via a denylist.

Specifics and Results

Checks for following forbidden test steps:

  • To-Do test step

  • Pre- or Postcondition

Return messages:

  • “Forbidden content of type <ts_type> in line <ts_line>!”

Limitations

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List

Needs to be implemented in the custom check (template method)

Parameters
test_item: item from Object API

generic test item; Package, Project or AnalysisPackage

parameters: any

the Parameters entry from config.yaml

Returns

list of CheckResult (empty if no violation was found)

UserPyModules.CustomChecks.CheckPackageGeneralInformation module

class UserPyModules.CustomChecks.CheckPackageGeneralInformation.CheckPackageGeneralInformation(internalApi)

Bases: AbstractPackageCheck

Check Package General Information

Description

Checks whether the general package information are valid.

Specifics and Results

Checks the following fields:

  • Package description

  • Package version

  • Package test case flag

Return messages:

  • “Description must not be empty!”

  • “Description insufficient. Should contain at least <value> characters!”

  • “Description should contain pattern.<CustomMessage>”

  • “Description should contain pattern: <RegexPattern>”

  • “TestCaseFlag must be set!”

  • “TestCaseFlag must not be set!”

  • “’<RegexPattern>’ is not a valid regular expression pattern. Check <config file>!”

  • “’<Version>’ does not match pattern <RegexPattern>”

Limitations

  • When more flags are added in the config, the source code needs to be extended

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List

Needs to be implemented in the custom check (template method)

Parameters
test_item: item from Object API

generic test item; Package, Project or AnalysisPackage

parameters: any

the Parameters entry from config.yaml

Returns

list of CheckResult (empty if no violation was found)

check_description(package, description)

Checks the description

Parameters
package: Package object

the package

description: dict

Description entry in the configuration

Returns

check results

check_test_case_flag(package, tc_flag)

Checks whether the test case flag is set

Parameters
package: Package object

the package

tc_flag: bool

tc_flag from the configuration

Returns

check results

check_version(package, version)

Checks the version

Parameters
package: Package object

the package

version: any

entry from the configuration

Returns

check results

UserPyModules.CustomChecks.CheckPackageLocalMapping module

class UserPyModules.CustomChecks.CheckPackageLocalMapping.CheckPackageLocalMapping(internalApi)

Bases: AbstractPackageCheck

Check Local Package Mapping

Description

Checks whether the package has forbidden mapping types in its local mapping via a denylist.

Specifics and Results

Instructions:

Specify the forbidden mapping types in the YAML configuration file

Return messages:

  • “mapping item with name ‘<mapping name>’ is of type ‘<mapping type>’ which is forbidden!”

Limitations

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List[CheckResult]

Needs to be implemented in the custom check (template method)

Parameters
test_item: item from Object API

generic test item; Package, Project or AnalysisPackage

parameters: any

the Parameters entry from config.yaml

Returns

list of CheckResult (empty if no violation was found)

check_mapping_item_mapping_type(mapping_item, deny_list) List[CheckResult]

Check a single mapping item for forbidden types

Parameters
mapping_item: Mapping item object

the mapping item

deny_list: List

list of forbidden mapping types

Returns

check results

check_package_mapping_types(package, parameters) List[CheckResult]

Check a package for forbidden mapping types in local mapping

Parameters
package: Package object

the package

parameters: Dict

the custom check parameters

Returns

check results

UserPyModules.CustomChecks.CheckPackageNamespace module

class UserPyModules.CustomChecks.CheckPackageNamespace.CheckPackageNamespace(internalApi)

Bases: AbstractPackageCheck

Check Package Namespace

Description

Checks whether the package file name is valid.

Instructions:

Specify the pattern of the checked packages in the YAML configuration file as Regex. The parameter for this check is called <RegexPackageName> in the config.yaml.

Return messages:

  • “Please save the package <package_name>. Could not find folder location!”

  • “<RegexPattern> is not a valid pattern!”

  • “<PackageName> does not follow name pattern. <CustomMessage>”

  • “<PackageName> does not follow name pattern: <Regex>”

Limitations

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List

Checks if package name matches regex pattern

UserPyModules.CustomChecks.CheckPackageVariables module

class UserPyModules.CustomChecks.CheckPackageVariables.CheckPackageVariables(internalApi)

Bases: AbstractPackageCheck

Check Package Variables

Description

  • Checks for each variable:
    • Whether the name matches the provided pattern

    • Whether the variable description matches the provided pattern

  • Checks whether the variables are sorted alphabetically. Following parameters must be

specified:
  • Sort method (ascending or descending)

  • Number of relevant characters from the beginning of each variable. With 0, False or None,

full variable names are considered.

Specifics and Results

  • Detailed information for invalid configuration
    • Required variables

    • Required parameters

    • Validation of the parameters (Type check, Regex Pattern compile)

Limitations

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List

Needs to be implemented in the custom check (template method)

Parameters
test_item: item from Object API

generic test item; Package, Project or AnalysisPackage

parameters: any

the Parameters entry from config.yaml

Returns

list of CheckResult (empty if no violation was found)

check_undefined_type(variable)

Checks varaible type is not undefined.

Parameters

variable: the variable to be checked

Returns

check results

check_unused_variable(package)

Checks if package contains unused variables

Parameters

package: the package to be checked

Returns

check results

check_variable(package, parameters)

Checks name and description of a given variable.

Parameters

variable: the package to be checked parameters: contains the expected values (name and description) of the checked parameters

Returns

check results

check_variable_description(variable, parameters)

Checks the description of the variables.

Parameters

variable: the variable to be checked parameters: contains the expected description

Returns

check results

check_variable_name(variable, parameters)

Checks name of a given variable.

Parameters

variable: the variable to be checked parameters: contains the expected name

Returns

check results

check_variable_order(package, parameters)

Checks the order of the variable list.

Parameters

variable: the package to be checked parameters: contains the expected ordering

Returns

check results

check_variable_type(variable)

Checks type consistency of a given variable.

Parameters

variable: the variable to be checked

Returns

check results

get_var_type(variable)

Determines the type of a variable (Local Var, Function, Parameter, Return value)

Parameters

variable: the variable to be checked

Returns

The type of the variable, or None if no matching type was found.

UserPyModules.CustomChecks.CheckProjectAttributes module

class UserPyModules.CustomChecks.CheckProjectAttributes.CheckProjectAttributes(internalApi)

Bases: AbstractProjectCheck

Check project Attributes

Description

Checks whether all project attributes are set according to YAML config.

Specifics and Results

Instructions:

Specify the attributes to be checked in the YAML configuration file according to the following pattern. Three types of checks are possible

1. Check if a value should exists for a specific attribute or if attributes should be left empty:

<attribute name>: True, False

  1. Check if a selected attribute value is in a list of allowed choices:
    <attribute name>:

    [<choice one>, <choice two>, …]

  2. Check if an attribute matches a specific pattern
    <attribute name>:

    “Regex Pattern”: <your pattern> (“Regex Description”: <description for error print>) optional

Return messages:

  • “<attribute name> must not be empty”

  • “<attribute name> must not be set

  • “<attribute name> no valid option out of: <attributes options>”

  • “No field: ‘Regex Pattern’ was provided!”

  • “<Provided pattern> is not a valid pattern!”

  • “<Provided pattern> does not match description: ‘Regex Description’ “

  • “<Provided pattern> does not match pattern: ‘Regex Pattern’”

GetName() str

Name to be shown in UI and used in the config.yaml

check(test_item, parameters) List

Needs to be implemented in the custom check (template method)

Parameters
test_item: item from Object API

generic test item; Package, Project or AnalysisPackage

parameters: any

the Parameters entry from config.yaml

Returns

list of CheckResult (empty if no violation was found)

Module contents