github.com/xgoffin/jenkins-library@v1.154.0/documentation/docs/steps/batsExecuteTests.md (about)

     1  # ${docGenStepName}
     2  
     3  ## ${docGenDescription}
     4  
     5  ## Prerequisites
     6  
     7  You need to have a Bats test file. By default you would put this into directory `src/test` within your source code repository.
     8  
     9  ## ${docGenParameters}
    10  
    11  ## ${docGenConfiguration}
    12  
    13  ## ${docJenkinsPluginDependencies}
    14  
    15  ## Example
    16  
    17  ```groovy
    18  batsExecuteTests script:this
    19  testsPublishResults junit: [pattern: '**/Test-*.xml', archive: true]
    20  ```
    21  
    22      With `envVars` it is possible to pass either fixed values but also templates using [`commonPipelineEnvironment`](commonPipelineEnvironment.md).
    23  
    24      Example:
    25  
    26      ```yaml
    27      batsExecuteTests script: this, envVars = [
    28        FIX_VALUE: 'my fixed value',
    29        CONTAINER_NAME: '\${commonPipelineEnvironment.configuration.steps.executeBatsTests.dockerContainerName}',
    30        IMAGE_NAME: '\${return commonPipelineEnvironment.getDockerImageNameAndTag()}'
    31      ]
    32      ```
    33  
    34      This means within the test one could refer to environment variables by calling e.g.
    35      `run docker run --rm -i --name \$CONTAINER_NAME --entrypoint /bin/bash \$IMAGE_NAME echo "Test"`