Skip to content

Changing your baseUrl without having to change GebConfig.groovy

Roland Stens edited this page Dec 6, 2017 · 1 revision

One of the simple annoyances with using the framework (and before with NavUnit) is to having to change GebConfig.groovy for a simple baseUrl change. Typically the repository version would point to the dev/test server but you want to run it locally.

We found that the simplest solution was to create a environment variable on your workstation called `BASEURL' that would automatically be picked up by GebConfig and if it is not there it would revert to the defined baseUrl in your file.

// Allows for setting you baseurl in an environment variable.
// This is particularly handy for development and the pipeline
def env = System.getenv()
baseUrl = env['BASEURL']
if (!baseUrl) {
	baseUrl = "<Your baseUrl>"
}

This will then also allow for the pipeline to be able to point to a specific target without having to change the file.

Clone this wiki locally