The concept of environments touches three areas of bubik:
For complex projects with multiple environments and internationalization const.ini file may quickly grow to structure similar to this:
[common]
webdriver.reset_on = "exec"
reporter_db.dsn = "mysql://bubik:bubik@localhost/bubik"
[pl_int]
start_url = "http://pl.int.buildmachine.local"
[pl_staging]
start_url = "https://pl.stagingmachine.local"
[pl_prod]
start_url = "https://pl.site.com"
[de_int]
start_url = "http://de.int.buildmachine.local"
[de_staging]
start_url = "https://de.stagingmachine.local"
[de_prod]
start_url = "https://de.site.com"
[ru_int]
start_url = "http://ru.int.buildmachine.local"
[ru_staging]
start_url = "https://ru.stagingmachine.local"
[ru_prod]
start_url = "https://ru.site.com"
In order to avoid creating multiple CSV file lines with same parameters, but differing only by __ column the following glob expressions are supported:
| __env | param_a | param_b |
|---|---|---|
| pl_* | AAA | BBB |
| de_* | DDD | EEE |
Table above is equivalent to:
| __env | param_a | param_b |
|---|---|---|
| pl_int | AAA | BBB |
| pl_staging | AAA | BBB |
| pl_prod | AAA | BBB |
| de_int | DDD | EEE |
| de_staging | DDD | EEE |
| de_prod | DDD | EEE |
When executing tests however globs are not supported, and a full list of all environments that test should be ran on has to be provided:
bubik -gregression -rconsole,db -ede_int,pl_int,ru_int
# the line below won't work
bubik -gregression -rconsole,db -e*.int
Let's consider a CSV file with few rows that have __env column set to valid environment (const ini file section) and some with this column left empty:
| __env | param_a | param_b |
|---|---|---|
| pl_* | AAA | BBB |
| de_* | DDD | EEE |
| XXX | YYY |
With such CSV file the third row will be executed always, no matter what values will be passed to -e switch in bubik command. In such case const values for const() function calls in test body will be taken from 'common' section. Let's consider some examples:
bubik -tMyTest -rconsole
# with no -e switch all rows from CSV are executed
bubik -tMyTest -rconsole -epl_prod
# first line from CSV will be used for environment pl_prod
# third line will be executed as well, [common] section used
bubik -tMyTest -rconsole -epl_prod,pl_int
# first line from CSV will be used twice for environments pl_prod and pl_int
# third line will be executed as well, [common] section used