Contents

command line options

In order to run rest-assured in different configurations (db params, port, etc) As test developer I need a way to specify those configurations.

Scenario Outline: specifying server port

  • When I start rest-assured with <option>
  • Then it should run on port <port>

Examples:

optionport
-p 12341234
--port 12351235
4578

Scenario Outline: specifying log file

  • When I start rest-assured with <option>
  • Then the log file should be <logfile>

Examples:

optionlogfile
-l /tmp/rest-assured.log/tmp/rest-assured.log
--logfile ./test.log./test.log
./rest-assured.log

Scenario Outline: sqlite options

  • When I start rest-assured with <options>
  • Then database adapter should be sqlite and db file should be <dbfile>

Examples:

optionsdbfile
./rest-assured.db
-d /tmp/ratest.db/tmp/ratest.db
--database /tmp/resta.db/tmp/resta.db

Scenario Outline: mysql options

  • When I start rest-assured with -a mysql <options>
  • Then database options should be:
    dbnamedbuserdbpassdbhostdbportdbencodingdbsocketadapter
    <dbname><dbuser><dbpass><dbhost><dbport><dbencoding><dbsocket><adapter>

Examples:

optionsdbnamedbuserdbpassdbhostdbportdbencodingdbsocketadapter
rest_assuredrootmysql2
-d restarestarootmysql2
--database restarestarootmysql2
-u bobrest_assuredbobmysql2
--dbuser bobrest_assuredbobmysql2
--dbpass pswdrest_assuredrootpswdmysql2
--dbhost remoterest_assuredrootremotemysql2
--dbport 5555rest_assuredroot5555mysql2
--dbencoding utf16lerest_assuredrootutf16lemysql2
--dbsocket /tmp/mysql.sockrest_assuredroot/tmp/mysql.sockmysql2

Scenario Outline: postgresql options

  • When I start rest-assured with -a postgresql <options>
  • Then database options should be:
    dbnamedbuserdbpassdbhostdbportdbencodingadapter
    <dbname><dbuser><dbpass><dbhost><dbport><dbencoding><adapter>

Examples:

optionsdbnamedbuserdbpassdbhostdbportdbencodingadapter
rest_assuredrootpostgresql
-d restarestarootpostgresql
--database restarestarootpostgresql
-u bobrest_assuredbobpostgresql
--dbuser bobrest_assuredbobpostgresql
--dbpass pswdrest_assuredrootpswdpostgresql
--dbhost remoterest_assuredrootremotepostgresql
--dbport 5555rest_assuredroot5555postgresql
--dbencoding utf16lerest_assuredrootutf16lepostgresql

Scenario Outline: use ssl option

  • When I start rest-assured with <option>
  • Then rest-assured should "<ssl>"

Examples:

optionssl
false
--ssltrue

Scenario Outline: specifying ssl options

  • When I start rest-assured with <option>
  • Then ssl certificate used should be "<ssl_cert>" and ssl key should be "<ssl_key>"

Examples:

optionssl_certssl_key
-c /tmp/mycert.crt/tmp/mycert.crtDEFAULT_KEY
--ssl_cert ./mycert.crt./mycert.crtDEFAULT_KEY
DEFAULT_CERTDEFAULT_KEY
-k /tmp/mykey.keyDEFAULT_CERT/tmp/mykey.key
--ssl_key ./mykey.keyDEFAULT_CERT./mykey.key

Source: features/command_line_options.feature at commit 63ec7a17, Rest Assured (Apache-2.0 license).