Testcafe: Implement config file

Created on 19 Nov 2018  路  3Comments  路  Source: DevExpress/testcafe

server Auto-locked enhancement

Most helpful comment

After discussion, we decide to implement the following concepts:

  • .testcaferc.json is a name of the configuration file.
  • <browser_name> and <sources> parameters become optional. I.e. it's a possible to run TestCafe with testcafe command.
  • configuration file are searched in the current directory (process.cwd()). If it exists then TestCafe reads the options from it.
  • if user-defined options merge with options from the configuration file then TestCafe shows the inform message 'The values for
  • BREAKING CHANGES: at present, it's forbidden to use multiple calls for src, browsers and reporter methods (see code exampe). Instead of this, pass an array of the arguments to the appropriate method.
  • Programmatic .reporter method supports the path to saved report as a second parameter
  return runner
      .reporter('json', '/reports/report.json')
  • Configuration file uses a command line naming convention
.testcaferc.json

{
             'hostname': '123.456.789',
             'port1':    1234,
             'port2':    5678,
             'src':      'path1/folder',
             'ssl':      {
                 'key':                keyFile.name,
                 'rejectUnauthorized': 'true'
             },
             'browsers':    'ie',
             'concurrency': 0.5,
             'filter':      {
                 'fixture':     'testFixture',
                 'test':        'some test',
                 'fixtureGrep': '^Unstable'
             },
             'reporter': 'json'
         }

All 3 comments

After discussion, we decide to implement the following concepts:

  • .testcaferc.json is a name of the configuration file.
  • <browser_name> and <sources> parameters become optional. I.e. it's a possible to run TestCafe with testcafe command.
  • configuration file are searched in the current directory (process.cwd()). If it exists then TestCafe reads the options from it.
  • if user-defined options merge with options from the configuration file then TestCafe shows the inform message 'The values for
  • BREAKING CHANGES: at present, it's forbidden to use multiple calls for src, browsers and reporter methods (see code exampe). Instead of this, pass an array of the arguments to the appropriate method.
  • Programmatic .reporter method supports the path to saved report as a second parameter
  return runner
      .reporter('json', '/reports/report.json')
  • Configuration file uses a command line naming convention
.testcaferc.json

{
             'hostname': '123.456.789',
             'port1':    1234,
             'port2':    5678,
             'src':      'path1/folder',
             'ssl':      {
                 'key':                keyFile.name,
                 'rejectUnauthorized': 'true'
             },
             'browsers':    'ie',
             'concurrency': 0.5,
             'filter':      {
                 'fixture':     'testFixture',
                 'test':        'some test',
                 'fixtureGrep': '^Unstable'
             },
             'reporter': 'json'
         }

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings