wttech/bobcat

Simplified Bobcat configuration

Closed this issue · 1 comments

Background

At the moment we are generating multiple properties files from the archetype and juggle them with Maven profiles, prolonging and complicating the whole setup process.

This improvement should provide a simplified approach to Bobcat configuration. A single human-readable file (preferably YAML) will contain all possible configuration options. They will be gathered in specific contexts (e.g. WebDriver properties, Bobcat properties, test data like environment URLs). Each context will then be activated by a command-line property.

Properties should be loaded in a way that allows injecting them via named injections, i.e. it should still be possible to do something like:

@Inject
@Named("publish.url")
private String publishUrl;

Examples

An example config.yaml:

default:  # always loaded
  parsys.locator.format: div.parsys.%s
  component.locator.format: div.%s
  parsys.finder.offset: 6
  proxy.enabled: false
  proxy.ip: 127.0.0.1
  proxy.port: 9000
  bobcat.report.path: ./target/report
  bobcat.report.reporters: html,json,simple,stdout
  webdriver.defaultTimeout: 10
  page.title.timeout: 30
  thread.count: 3
webdriver:
  grid:
    webdriver.type: remote
    webdriver.url: http://192.168.1.2:4444/wd/hub
    webdriver.cap.browserName: chrome
  localChrome:
    webdriver.type: chrome
    webdriver.chrome.driver: E:/chromedriver.exe
testData:
  local:
    author.url: http://localhost:4502
    author.ip: http://127.0.0.1:4502
    author.login: admin
    author.password: admin
    login.token.name: login-token
    publish.url: http://localhost:4503
    publish.ip: http://127.0.0.1:4503
    publish.login: admin
    publish.password: admin
  dev:
    author.url: http://myauthor.com
    author.ip: http://127.0.0.1:4502
    author.login: admin
    author.password: admin
    login.token.name: login-token
    publish.url: http://mypublish.com
    publish.ip: http://127.0.0.1:4503
    publish.login: admin
    publish.password: admin

An example usage of executing a test run for dev instance, with the grid WebDriver config: mvn test -Dconfig.webdriver=grid -Dconfig.testData=dev

Additional improvements

  • provide a possibility of marking some configurations as default ones, to further simplify CLI usage, e.g. with the following config:
default:  # always loaded
  ...
webdriver:
  default: local
  grid:
    ...
  local:
    ...
  ...
testData:
  default: local
  local:
    ...
  dev:
    ...

a mvn test would run with webdriver=local and testData=local contexts.

  • consider creating custom contexts, e.g.:
default:  # always loaded
  ...
webdriver:
  ...
testData:
  ...
myCustomContext:
  configA:
    my.property: a
  configB:
    my.property: b

Done. The implementation differs a bit from the initial concept above.
Documentation: https://github.com/Cognifide/bobcat/wiki/Configuring-Bobcat