2019-04-09 08:39:20 +02:00
|
|
|
# ${docGenStepName}
|
2018-08-15 11:41:01 +02:00
|
|
|
|
2019-04-09 08:39:20 +02:00
|
|
|
## ${docGenDescription}
|
2018-08-15 11:41:01 +02:00
|
|
|
|
|
|
|
## Prerequsites
|
|
|
|
|
|
|
|
You need to have a Bats test file. By default you would put this into directory `src/test` within your source code repository.
|
|
|
|
|
2019-04-09 08:39:20 +02:00
|
|
|
## ${docGenParameters}
|
2018-08-15 11:41:01 +02:00
|
|
|
|
2019-04-09 08:39:20 +02:00
|
|
|
## ${docGenConfiguration}
|
2018-08-15 11:41:01 +02:00
|
|
|
|
2019-05-24 15:44:31 +02:00
|
|
|
## ${docJenkinsPluginDependencies}
|
2019-05-24 15:41:49 +02:00
|
|
|
|
2019-04-09 08:39:20 +02:00
|
|
|
## Example
|
2018-08-15 11:41:01 +02:00
|
|
|
|
2019-04-09 08:39:20 +02:00
|
|
|
```groovy
|
|
|
|
batsExecuteTests script:this
|
|
|
|
testsPublishResults junit: [pattern: '**/Test-*.xml', archive: true]
|
|
|
|
```
|
2018-08-15 11:41:01 +02:00
|
|
|
|
|
|
|
With `envVars` it is possible to pass either fixed values but also templates using [`commonPipelineEnvironment`](commonPipelineEnvironment.md).
|
|
|
|
|
|
|
|
Example:
|
2018-11-06 14:50:09 +02:00
|
|
|
|
|
|
|
```yaml
|
2018-08-15 11:41:01 +02:00
|
|
|
batsExecuteTests script: this, envVars = [
|
|
|
|
FIX_VALUE: 'my fixed value',
|
2019-04-09 08:39:20 +02:00
|
|
|
CONTAINER_NAME: '\${commonPipelineEnvironment.configuration.steps.executeBatsTests.dockerContainerName}',
|
|
|
|
IMAGE_NAME: '\${return commonPipelineEnvironment.getDockerImageNameAndTag()}'
|
2018-08-15 11:41:01 +02:00
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
This means within the test one could refer to environment variables by calling e.g.
|
2019-04-09 08:39:20 +02:00
|
|
|
`run docker run --rm -i --name \$CONTAINER_NAME --entrypoint /bin/bash \$IMAGE_NAME echo "Test"`
|