Project Configuration
Project-level configuration files - oxygen.conf.js
Starting from version 1.0, oxygen-cli no longer supports suite definitions using JSON files, and instead supports only project level configuration via a file named oxygen.conf.js . An example configuration file is listed below. Please note, that the file should be named exactly oxygen.conf.js and located in the project directory along with all the test scripts, in order for oxygen-cli to recognize it.
To launch a project using configuration file, execute: oxygen oxygen.conf.js Pass full path to the configuration file if necessary.
1
module.exports = {
2
3
// ============
4
// Suites
5
// ============
6
//
7
// For example, here we have two suites defined, with first suite having two cases
8
// and second suite having only a single case.
9
//
10
suites: [
11
{
12
name: 'Selenium', // suite name
13
cases: [ // cases inside this suite
14
{
15
path: './tests/selenium-with-po.js'
16
},
17
{
18
path: './tests/pdf.js'
19
}
20
]
21
},{
22
name: 'Visual',
23
cases: [
24
{
25
path: './tests/visual.js'
26
}
27
]
28
}
29
],
30
31
// ============
32
// Capabilities
33
// ============
34
//
35
// If "concurrency" value is greater than 1,
36
// tests with different capabilities will be executed in parallel.
37
//
38
concurrency: 1,
39
capabilities: [
40
{
41
browserName: 'chrome', // execute on Chrome
42
},
43
{
44
browserName: 'firefox', // execute on Firefox
45
}
46
],
47
48
// ============
49
// Parameters
50
// ============
51
//
52
parameters : {
53
file: '<excel or csv file path>',
54
mode: 'seq', // can be 'random' or 'all' as well
55
},
56
57
// ============
58
// Iterations
59
// ============
60
//
61
// Tests will run only once if iterations number is not explicitly specified.
62
//
63
iterations: 1,
64
65
// ============
66
// Selenium & Appium server URLs
67
// ============
68
//
69
// If not specified, the default URLs will be used
70
//
71
seleniumUrl: 'http://localhost:4444/wd/hub',
72
appiumUrl: 'http://localhost:4723/wd/hub',
73
74
// ============
75
// Services
76
// ============
77
//
78
// List services you want to enable during the test execution.
79
// Available services: selenium-standalone | devtools
80
// selenium-standalone needs to be installed with `npm i @wdio/selenium-standalone-service` first.
81
//
82
services: ['selenium-standalone', 'devtools'],
83
84
// ============
85
// Modules
86
// ============
87
// List modules you want to enable during the test execution.
88
// Loading unnecessary modules might slow down your test execution,
89
// so only load modules that are used in the test.
90
// See here https://docs.oxygenhq.org for a list of available modules.
91
//
92
modules: ['web', 'db', 'log', 'assert', 'pdf', 'http', 'email'],
93
94
// ============
95
// Framework
96
// ============
97
// Define a testing framework for this project.
98
// Available frameworks: oxygen | cucumber
99
//
100
framework: 'oxygen',
101
102
// ============
103
// Reporting
104
// ============
105
// Define test reporter format and corresponding options.
106
// Multiple reporter formats can be specified.
107
// Available reporters: json | html | junit | excel | pdf | xml
108
//
109
reporting: {
110
reporters: ['json'],
111
},
112
113
// ==========
114
// Applitools
115
// ==========
116
// Define your Applitools service API key.
117
// This is only for when using the `eyes` module.
118
//
119
applitoolsOpts: {
120
key: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
121
},
122
123
// ==========
124
// Hooks
125
// ==========
126
// Oxygen provides several hooks that can be used to interfere with the test
127
// execution process.
128
//
129
hooks: {
130
//
131
// Hook that gets executed before the test starts.
132
// At this point, Oxygen has been already initialized, so you
133
// can access Oxygen functionality via relevant modules.
134
//
135
beforeTest: function(runId, options, caps) {
136
},
137
beforeSuite: function(suiteDef) {
138
},
139
beforeCase: function(caseDef) {
140
log.info('Hey there! Case is about to start.');
141
},
142
beforeCommand: function(cmdDef) {
143
},
144
afterCommand: function(cmdResult) {
145
},
146
afterCase: function(caseDef, caseResult) {
147
},
148
afterSuite: function(suiteDef, suiteResult) {
149
},
150
afterTest: function(runId, testResult) {
151
}
152
}
153
};
Copied!
Please see the Sample Project for an example of a project configuration file.
Last modified 1yr ago
Copy link