...
Test Automation provides a way for you to define post-deployment tests. These are often used as smoke tests to ensure that the deployment completed successfully. They can also be used to run regression tests and any other testing that is targeted to the deployed target. Tests can be executed as part of build, deploy or utility workflow executions as well.
The Test Automation settings configurations, defined in yamlYAML, are found in the project configuration.
...
The YAML that is shown here can also be stored in source control in the projet_root/fdtests
folder to allow for versioning of the test configuration. For example:
...
Info |
---|
artifacts/fdtests directory of a project’s latest successful deployment are tested in addition to the project’s test configuration on test execution within FlexDeploy
|
Once the yaml YAML file is configured on project and/or saved in your projects source code you are ready to begin executing tests!
...
Armed with this information, type test- and select a tool you want to use for running tests.
...
Once selected, sample yaml YAML configuration will be inserted that you can modify as you see fit. See the yaml YAML definition below for more details.
Below is the generated yaml YAML for Postman
...
In this particular example it can run as is provided the newman cli is installed, but we will make one modification to specify a specific Test Instance for it to run on. ctrl+space
or simply start typing to see suggestions of Test Instances.
...
While modifying the test configuration in the editor, available fields and values will always be suggested to you. As such understanding the yaml YAML definition below is certainly NOT REQUIRED but certainly can be helpful in understanding how things work.
Field | Data type | Description | Notes |
---|---|---|---|
[testRoot] denoted | Array | Multiple tests can be defined in the yaml YAML configuration and are separated by | Every test in the file must start with |
testName | String | Unique name of the test within the yaml YAML configuration | When executing tests you can specify a specific name filter to execute individual tests |
description | String | Description of the test | - |
workflow | Object | The workflow that will be executed when executing this test | |
workflow/name | String | The name of the workflow as it appears in the workflow UI. | Valid test workflow names show as editor suggestions. Can be triggered by typing or hitting |
workflow/inputs | Array | A list of workflow inputs for the specified workflow. Only inputs configured on the workflow are valid here. | All available inputs for the specified workflow will be auto inserted when auto completing the inputs field, provided the name has already been specified. |
workflow/inputs/code | String | Workflow Input Code for the specified workflow. It should match the code as seen on the workflow screen. | Valid workflow input codes will be suggested provided the workflow name has been specified |
workflow/inputs/value | String | The value of the current workflow input | Can be plain text or variables can be used. |
workflow/inputs/groovy | Boolean | Flag indicating if the provided value should be treated as a groovy expression | |
tags | String | @Since 7.0.0.1 - A comma separated list of tags used for filtering tests on execution | Quick selection of tags can be accessed by hitting |
filters | Array | A list of filters that limit the conditions under which the given test will execute. | For example an |
filters/type | String | The type of filter to use. Valid values are: | |
filters/value | String | The value of the supplied filter | Possible values are suggested based on the filter/type specified. |
...
Integrating with Release/Pipeline
The real power of test automation comes when integrated within FlexDeploy’s FlexDeploy Release Orchestration platform. Here we can allow or block further deployments based on the test results of a project.
...
The above example is a minimalistic pipeline just to demonstrate how it integrates with FlexDeploy’s FlexDeploy Test Automation framework.
Executes any tests on projects in the Development Environment after deployment to the Development Environment.
...
This means any tests with an
env
filter with a value ofDEVELOPMENT
or no filters at all would be executed as seen below
Code Block |
---|
---
testName: Postman Test
description: Generated Postman Test
filters:
- type: env
value: DEVELOPMENT
workflow:
name: PostmanDocker
inputs:
- code: FDPMN_COLLECTION_FILE
value: .*collection.json
# (Optional) null
- code: FDPMN_ENVIRONMENT_FILE
value: fdtests/postman_environment_TOMCATPOSTGRES.json |
A Gate that will block or allow progression of deployments to the Test Stage.
In the configuration for Step 2 we have said that All Tests must PASS in order for progression to continue.
Info |
---|
Note that the criteria specified applies to each project on an individual basis, however all Projects must pass the criteria for the gate to succeed. For example suppose the gate criteria is |
Using variables in
...
YAML test definitions
YAML uses backslash as its escape character and eats the first layer of quote marks.
Use Double Quotes around values containing '$' or '{'.
...
Code Block |
---|
value: "\$${FD_INSTANCE_CODE}_PROPERTY_CODE" |
Configuration with a custom workflow
Other workflows can be designed and used in the same manner as this one. Create workflow inputs for any options you want to expose to the yaml YAML file. Map the workflow inputs into plugin inputs as groovy values. Activate the workflow. Fill in the values in the yaml YAML file, referencing the workflow input codes.
When you choose a workflow name, consider including one of the values from the workflow prefix table
Workflow Inputs
Workflow inputs specified in the yaml YAML configuration directly correspond with the inputs as seen in the workflow definition.
...
Info |
---|
Note that workflow inputs and workflow input codes are autocompleted in the test editor provided you have specified a valid workflow name. |
TEST_INSTANCE Workflow Input
Code Block |
---|
workflow: name: inputs: - code: TEST_INSTANCE value: |
...