Skip to content

Commit

Permalink
Functional tests report (Dash-Industry-Forum#3206)
Browse files Browse the repository at this point in the history
* set tests output directory for circle-ci

* functional tests: update config

* [tmp] circleci test

* [tmp] circleci test

* [tmp] circleci test

* circleci: set output functional tests results filename

* circleci: set output functional tests results filename

* circleci: set output functional tests results filename

* circleci: set output functional tests results filename

* circleci: set output functional tests results filename

* circleci: add tests results as artifact

* circleci: add tests results as artifact

* [tmp] circleci test

* [tmp] circleci test

* functional tests: complete tests suites names for report

* [tmp] circleci test

* functional tests: run also tests for http streams

* [tmp] circleci test

* functional tests: run also tests for http streams

* circleci: set output functional tests results filename

* [tmp] circleci test

* functional tests: update readme

* circleci: set output functional tests results filename

* [tmp] circleci test

* circleci: run multiple tests sequences

* [tmp] circleci test

* [tmp] circleci test

* [tmp] circleci test

* Revert "[tmp] circleci test"

This reverts commit bf22b03.

* Revert "[tmp] circleci test"

This reverts commit 1121d75.

* Revert "[tmp] circleci test"
  • Loading branch information
bbert authored Mar 26, 2020
1 parent 04499cb commit d17a44c
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 31 deletions.
24 changes: 17 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2

_defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:7.10
working_directory: ~/repo
docker:
- image: circleci/node:7.10

_steps:
restore_cache: &restore_cache
Expand Down Expand Up @@ -55,7 +55,6 @@ jobs:
- restore_cache: *restore_cache
- run: *install_dependencies
- save_cache: *save_cache

# run functional tests
- run:
# Download the browserstack binary file to create a tunnel
Expand All @@ -74,9 +73,20 @@ jobs:
background: true

- run:
# Run functional tests
name: Run functional tests
command: node node_modules/intern/runner.js config=test/functional/config.js selenium=remote app=remote browsers=chrome
# Run functional tests for chrome browser for https
name: Run functional tests (chrome / https)
command:
node node_modules/intern/runner.js config=test/functional/config.js selenium=remote app=remote browsers=chrome protocol=https

- run:
# Run functional tests for chrome browser for http
name: Run functional tests (chrome / http)
when: always # run tests even if some previous tests failed
command:
node node_modules/intern/runner.js config=test/functional/config.js selenium=remote app=remote browsers=chrome protocol=http

- store_test_results:
path: test/functional/reports

workflows:
version: 2
Expand Down
8 changes: 5 additions & 3 deletions test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define(function(require) {
defaultTimeout: 30000,

// A regular expression matching URLs to files that should not be included in code coverage analysis
excludeInstrumentation: /^tests|bower_components|node_modules|testIntern/,
excludeInstrumentation: /^test|node_modules/,

// to keep browser opened at the end of the test
leaveRemoteOpen: false
Expand Down Expand Up @@ -79,7 +79,9 @@ define(function(require) {
}

// Set application protocol
conf.testPage = conf.protocol + '://' + conf.testPage
if (!conf.testPage.startsWith('http')) {
conf.testPage = conf.protocol + '://' + conf.testPage
};

console.log('conf.testPage: ' + conf.testPage);

Expand All @@ -99,4 +101,4 @@ define(function(require) {
// console.log(JSON.stringify(conf, null, ' '));

return conf;
});
});
2 changes: 1 addition & 1 deletion test/functional/config/applications.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define({
local:'localhost:3000/samples/functional-tests/index.html',
local:'http://localhost:3000/samples/functional-tests/index.html',
remote:'reference.dashif.org/dash.js/nightly/samples/functional-tests/index.html',
});
18 changes: 15 additions & 3 deletions test/functional/config/selenium.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ define({
port: '4444',
verbose: true
},
reporters: ['Runner'],
reporters: [
'Runner',
{
id: 'JUnit',
filename: 'test/functional/reports/junit/results_' + (new Date().getFullYear())+'-'+(new Date().getMonth()+1)+'-'+(new Date().getDate())+'_'+(new Date().getHours())+'-'+(new Date().getMinutes()) + '.xml'
}
],
capabilities: {
'selenium-version': '3.4.0'
},
Expand All @@ -31,6 +37,12 @@ define({
username: process.env.BROWSERSTACK_USER || 'BROWSERSTACK_USER',
accessKey: process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACCESS_KEY'
},
reporters: ['Runner', {id: 'JUnit', filename: 'test/functional/test-reports/' + (new Date().getFullYear())+'-'+(new Date().getMonth()+1)+'-'+(new Date().getDate())+'_'+(new Date().getHours())+'-'+(new Date().getMinutes())+'-'+(new Date().getSeconds()) + '_report.xml'}]
reporters: [
'Runner',
{
id: 'JUnit',
filename: 'test/functional/reports/junit/results_' + (new Date().getFullYear())+'-'+(new Date().getMonth()+1)+'-'+(new Date().getDate())+'_'+(new Date().getHours())+'-'+(new Date().getMinutes()) + '.xml'
}
]
}
});
});
4 changes: 2 additions & 2 deletions test/functional/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ cd test/functional

As for Windows, the script can be modified to setup the tests.

####Troubleshooting
#### Troubleshooting
Question: The localhost:3000 webserver is not available and all tests fail.
Answer: A local webserver needs to run on port 3000. In order to launch a debug server launch the following command in the root folder of the project:
```
npm dev
npm run dev
```

Question: The webserver responds with "cannot establish a secure connection"
Expand Down
6 changes: 3 additions & 3 deletions test/functional/tests/ended.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define([

var load = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

load: function() {
if (!stream.available) this.skip();
Expand All @@ -49,7 +49,7 @@ define([

var seek = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

seek: function() {
if (!stream.available) this.skip();
Expand All @@ -66,7 +66,7 @@ define([

var ended = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

ended: function() {
if (!stream.available) this.skip();
Expand Down
4 changes: 2 additions & 2 deletions test/functional/tests/pause.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ define([

var load = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

load: function() {
if (!stream.available) this.skip();
Expand All @@ -55,7 +55,7 @@ define([
var pause = function(stream) {

registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

pause: function() {
if (!stream.available || stream.duration < 60) this.skip();
Expand Down
6 changes: 3 additions & 3 deletions test/functional/tests/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define([

var load = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

load: function() {
if (!stream.available) this.skip();
Expand All @@ -40,7 +40,7 @@ define([

var play = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

play: function() {
if (!stream.available) this.skip();
Expand All @@ -66,7 +66,7 @@ define([

var getInfos = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

isDynamic: function() {
if (!stream.available) this.skip();
Expand Down
4 changes: 2 additions & 2 deletions test/functional/tests/playFromTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define([

var loadAtRValue = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

load: function() {
if (!stream.available) this.skip();
Expand All @@ -53,7 +53,7 @@ define([

var play = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

play: function() {
if (!stream.available) this.skip();
Expand Down
7 changes: 6 additions & 1 deletion test/functional/tests/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ define([
], function (intern) {

var defaultTimeout = intern.config.defaultTimeout;

return {

testName: function (name, stream) {
return stream.name + ' # ' + name;
},


info: function (tag, message) {
console.info('[' + tag + ']', message);
},
Expand Down
6 changes: 3 additions & 3 deletions test/functional/tests/seek.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ define([
}
return pos;
};

var load = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

load: function() {
if (!stream.available) this.skip();
Expand All @@ -71,7 +71,7 @@ define([

var seek = function(stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

seek: function() {
if (!stream.available) this.skip();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/tests/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ define([

var setup = function (stream) {
registerSuite({
name: NAME,
name: utils.testName(NAME, stream),

setup: function () {
utils.info(NAME, 'Setup stream: ' + stream.name);
Expand Down

0 comments on commit d17a44c

Please sign in to comment.