-
Notifications
You must be signed in to change notification settings - Fork 5
Configuration
In order to create an empty configuration files for your project, type bender init. This will create a following structure in your current working directory:
.
..
/.bender/
- bender.js
/bender.js
-
/.bender/- Bender's local directory - contains the cache, databases and local configuration file -
/.bender/bender.js- local configuration file - this file should be unique for each developer's environment -
/bender.js- project configuration file - should contain a common project's configuration shared between the developers
You can also define a global Bender configuration stored in .bender/bender.js file located in your HOME directory.
On Windows this would be:
C:\Users\<user_name>\.bender\bender.js
On Linux:
~/.bender/bender.js
Following order is used while starting Bender:
- Bender defaults
- Global configuration -
<home>/.bender/bender.js - Project configuration -
project/bender.js - Local configuration -
project/.bender/bender.js
Subsequent configuration override options defined in previous one.
Bender has predefined list of configuration options. However, the list of options can be extended by a 3rd party plugin.
Below is the list of default Bender configuration options:
- applications
- browsers
- captureTimeout
- certificate
- debug
- defermentTimeout
- framework
- hostname
- manualBrowsers
- manualTestTimeout
- plugins
- port
- privateKey
- secure
- slowAvgThreshold
- slowThreshold
- startBrowser
- testRetries
- tests
- testTimeout
(Optional)
Defines a list of applications used in the project in following structure:
applications: {
<applicationName>: {
path: <applicationPath>,
files: <applicationFiles>,
proxy: <applicationServer>,
url: <applicationURL>
}
}
Each application has multiple properties that can be defined:
-
path- a path to application's directory (Optional)Example:
applications: { foo: { path: 'foo/', files: [ 'core.js', 'lib/bar.js' ] } } /* after Bender server is started, it will host application's files under following URLs: http://localhost:1030/apps/foo/core.js http://localhost:1030/apps/foo/lib/bar.js */
-
proxy- an address of application's server where Bender should proxy to (Optional)Example
applications: { foo: { proxy: 'http://cdn.foo.com/', files: [ 'core.js', 'lib/bar.js' ] } } /* after Bender server is started, it will proxy following URLs to the application's server: http://localhost:1030/apps/foo/core.js -> http://cdn.foo.com/apps/foo/core.js http://localhost:1030/apps/foo/lib/bar.js -> http://cdn.foo.com/apps/foo/lib/bar.js */
-
url- application's URL that will be used by Bender to host application's files. If not specified, application's name will be used. (Optional)Example:
applications: { foo: { path: 'foo/', url: 'custom-url/', files: [ 'core.js', 'lib/bar.js' ] } } /* after Bender server is started, it will host application's files under following URLs: http://localhost:1030/apps/custom-url/core.js http://localhost:1030/apps/custom-url/lib/bar.js */
-
files- an array of files that should be included in the test context. (Optional)Example:
applications: { foo: { path: 'foo/', files: [ 'core.js', 'lib/bar.js', 'style.css' ] } }
When a test is executed, application's files will be included in the the test page
<head>section:<head> ... <script src="/apps/foo/core.js"></script> <script src="/apps/foo/lib/bar.js"></script> <link rel="stylesheet" href="/apps/foo/style.css"></link> ... </head>
(Optional)
Default: ['IE8', 'IE9', 'IE10', 'IE11', 'Firefox', 'Safari', 'Chrome', 'Opera']
Default list of browsers to be used while creating a job. You can define a whole family of browsers or a specific major version of it.
Example:
browsers: ['chrome', 'firefox', 'ie11']
/*
This means if you create a job for all of these browsers, any version of Chrome and Firefox and Internet Explorer in version 11 can be used to execute a job
*/(Optional)
Default: 10s
A timeout before which a launched browser should connect to the server.
(Optional)
Location of the certificate file. Related to privateKey and secure.
If you wish to use secure connection when testing your project and you do not have a certificate file you may use server.crt included in Bender.js main directory or you may generate your own (you may need OpenSSL tool on Windows).
(Optional)
Enable debug logs and expanded stack traces.
(Optional)
Default: 5s
A timeout before which a plugin should finish initializing on a test page. Bender exposes bender.defer() method that allows to defer the test execution and returns an unlock function. The unlock function should be called before this timeout expires.
(Optional)
Define a default test framework for the project. This option could be overridden by test group's framework property.
Example:
framework: 'yui'(Optional)
A host on which the HTTP and WebSockets servers will listen.
(Optional)
Default: ['IE8', 'IE9', 'IE10', 'IE11', 'Firefox', 'Safari', 'Chrome', 'Opera']
A list of browsers accepting manual tests.
(Optional)
Default: 60s
A timeout after which a manual test is marked as failed while executed from a job.
(Required)
List of plugins to be loaded on Bender's startup. For more information on plugins, see Plugins wiki page.
Example:
plugins: ['benderjs-jasmine', 'benderjs-jquery'](Optional)
A port on which the HTTP and WebSockets servers will listen.
(Optional)
Location of the private key file. Related to certificate and secure.
If you wish to use secure connection when testing your project and you do not have a private key file you may use server.key included in Bender.js main directory or you may generate your own (you may need OpenSSL tool on Windows).
(Optional)
Default: false
Flag telling whether to serve contents over HTTPS and WSS. To make it work properly you have to also define path to privateKey and certificate.
(Optional)
Default: 200ms
Average test duration threshold above which a test is marked as slow.
(Optional)
Default: 30s
Test duration threshold above which a test is marked as slow.
(Optional)
Default: phantomjs
Name of a browser to start when executing bender run command.
(Optional)
Default: 3
A number of retries to perform before marking a test as failed. This one is used when running a test from a job.
(Required)
List of test groups for the project. At least one test group must be defined.
Each test group has multiple configuration options:
-
applications- a list of applications to be loaded in test context for this group's tests (Optional)Example:
applications: { foo: { path: 'foo/', files: [ 'core.js', 'style.css' ] } }, framework: 'yui', tests: { SampleGroup: { applications: ['foo'], basePath: 'tests/', paths: ['**'] } } /* when a test from the SampleGroup is executed, 'foo' application's files will be included in the test page */
-
framework- name of a test framework to use in the tests from this group. This will override the default framework defined in the configuration file. (Optional)Example:
framework: 'yui', plugins: ['benderjs-yui', 'benderjs-qunit'], tests: { SampleGroup: { applications: ['foo'], framework: 'qunit', // this will override the default framework basePath: 'tests/', paths: ['**'] } }
-
basePath- base path to tests directory. (Required) -
paths- a list of paths (patterns) used to build the tests list visible on the Dashboard. Paths are relative to thebasePathof the group. Paths support globstar matching so patterns likefoo/**/*.jsare supported. (Required)Example:
framework: 'yui', tests: { SampleGroup: { basePath: 'tests/', paths: [ 'one/**', 'two/**' ] } } /* in such configuration, Bender will search tests/one/ and test/two/ directories for tests */
You can exclude some paths, i.e. containing test assets, by adding
!at the beginning of the path.Example:
tests: { SampleGroup: { basePath: 'tests/', paths: [ 'one/**', 'two/**', '!one/_assets/**' ] } } /* such configuration means that 'one/_assets/' directory will be omitted */
-
regressions- an object defining regressions list, where keys are IDs of the tests and values are regression occurrence condition. Format of the ID is following:<test_file_ID>#<test_name>For example, if you're aware that a test should fail on a specific browser, you can put a browser version check as the condition. If it's true, a test will be marked as ignored for this specific browser.
Example:
tests: { SampleGroup: { basePath: 'tests/', paths: ['one/**'], regressions: { 'one/foo#test of a feature': 'navigator.userAgent.toLowerCase().indexOf( "trident" ) > -1' } } }
In this example,
navigator.userAgent.toLowerCase().indexOf( 'trident' ) > -1code will be evaluated in the test context. If the result is truthy, then this specific test is marked as ignored.
(Optional)
Default: 60s
A timeout after which a test will be fetched again or marked as failed (timed-out).
It's possible to use custom configuration options in the plugins. More information on how to use values from the configuration file in custom plugins can be found on Plugins wiki page.