Skip to main content
Version: 0.10.1

Dynamic configuration

Marathon allows you to pass dynamic variables to your marathon configuration, e.g. a list of tests or url for analytics backend.

CLI

Marathonfile support environment variable interpolation in the Marathonfile. Every occurrence of ${X} in the Marathonfile will be replaced with the value of envvar X For example, if you want to dynamically pass the index of the test run to the fragmentation filter:

filteringConfiguration:
allowlist:
- type: "fragmentation"
index: ${MARATHON_FRAGMENT_INDEX}
count: 10

and then execute the testing as following:

foo@bar:~$ MARATHON_FRAGMENT_INDEX=0 marathon

Gradle

To pass a parameter to the Gradle's build script:

foo@bar:~$ gradle -PmarathonOutputDir=reports
marathon {
output = property("marathonOutputDir")
}

Note that dynamic properties must be named differently from fields they set.

You can use findProperty() for optional properties:

marathon {
filteringConfiguration {
allowlist {
annotationFilter = findProperty('marathonAnnotations')?.split(',') ?: []
}
}
}

For more info refer to the Gradle's dynamic project properties

Contents