utPLSQL / utPLSQL-cli

Command line client for invoking utPLSQL
Apache License 2.0
40 stars 15 forks source link

Add json config file for utplsql-cli #23

Open jgebal opened 7 years ago

jgebal commented 7 years ago

Calling the command like utplsql run ... -config=config.json should work when we pass the configuration json file as below:

{
  "connection": {
    "user": "hr",
    "password": "hr",
    "host": "localhost",
    "port": 1521,
    "service_name": "xe"
  },
  "suite_paths": [ 
    "hr",
    "usr"
  ],

  "color": true, 
  "reporters": [
    {
      "ut_documentation_reporter": {
        "output": "results.txt",
        "screen": true
      }
    },
    {
      "ut_xunit_reporter": {
        "output": "results.json"
      }
    },
    {
      "ut_coverage_html_reporter": {
        "output": "coverage.html",
        "screen": true
      }
    }
  ],
  "sources_path": "/source",
  "tests_path": "/test"
}

-"host" is optional - default: 127.0.0.1 -"port" is optional - default: 1521 -"service_name" or "sid" must be provided -"suite_paths" - optional -"color" - optional -"reporters" - optional -"reporter parameters" - optional -"sources_path" - optional -"tests_path" - optional

jgarec commented 6 years ago

Interesting as it allows to reduce the number of arguments on the command line.

I think it should not be exclusive. Loading some parameters from the config file (reporters, paths, ...) and others from the command line (connection string for example).

Would be great if this config file could also be used with the utplsql maven plugin.

jgebal commented 6 years ago

I think it would be good to allow for separation of credentials(connect string) from rest of the config. This would allow the config to be project bound and connection to be more CI server driven. Alternatively we could simply allow calling client with both config file and command line parameters. In that cade, explicit params would take precedence and would override config file settings. So project can have it's configuration file in version control and when running command on CI you could override Parana.

I would also use a default name for the config file and do a lookup for that file.

This way you can just invoke utplsql run if your configuration file exists. If it doesn't we could inform about missing parameters as we do today.

pesse commented 6 years ago

Good input, thanks to both of you :)