Skip to content

Commit f27b00f

Browse files
committed
Publish test results to BrowserScope
1 parent 96c1f20 commit f27b00f

File tree

1 file changed

+52
-16
lines changed

1 file changed

+52
-16
lines changed

test/TestStacktrace.html

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<!DOCTYPE html>
22
<!--
3-
Copyright (C) 2008 Johan Euphrosine <[email protected]>
4-
Copyright (C) 2008 Loic Dachary <[email protected]>
5-
Copyright (C) 2011 Eric Wendelin <[email protected]>
6-
7-
This program is free software: you can redistribute it and/or modify
8-
it under the terms of the GNU General Public License as published by
9-
the Free Software Foundation, either version 3 of the License, or
10-
(at your option) any later version.
11-
12-
This program is distributed in the hope that it will be useful,
13-
but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
GNU General Public License for more details.
16-
17-
You should have received a copy of the GNU General Public License
18-
along with this program. If not, see <http://www.gnu.org/licenses/>.
3+
Copyright (C) 2008 Johan Euphrosine <[email protected]>
4+
Copyright (C) 2008 Loic Dachary <[email protected]>
5+
Copyright (C) 2011 Eric Wendelin <[email protected]>
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
-->
2020
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en' dir='ltr' id='html'>
2121
<head>
@@ -27,6 +27,42 @@
2727
<script type='text/javascript' src='../stacktrace.js'></script>
2828
<script type='text/javascript' src='CapturedExceptions.js'></script>
2929
<script type='text/javascript' src='TestStacktrace.js'></script>
30+
<script>
31+
var _bTestResults = {};
32+
33+
// Add URL option in QUnit to toggle publishing results to BrowserScope.org
34+
QUnit.config.urlConfig.push("publish");
35+
QUnit.config.testTimeout = 1000; // Timeout for async tests
36+
37+
// Build-up the test results beacon for BrowserScope.org
38+
QUnit.testDone = function(test) {
39+
// make sure all assertions passed successfully
40+
if (!test.failed && test.total === test.passed) {
41+
_bTestResults[test.name] = 1;
42+
} else {
43+
_bTestResults[test.name] = 0;
44+
}
45+
}
46+
47+
// If the user agreed to publish results to BrowserScope.org, go for it!
48+
QUnit.done = function() {
49+
if (QUnit.config.publish) {
50+
var testKey = 'agt1YS1wcm9maWxlcnINCxIEVGVzdBjr68MRDA';
51+
var newScript = document.createElement('script');
52+
var firstScript = document.getElementsByTagName('script')[0];
53+
54+
newScript.src = 'http://www.browserscope.org/user/beacon/' + testKey + "?callback=showResults";
55+
firstScript.parentNode.insertBefore(newScript, firstScript);
56+
}
57+
}
58+
59+
// Load the results widget from browserscope.org
60+
function showResults() {
61+
var script = document.createElement('script');
62+
script.src = "http://www.browserscope.org/user/tests/table/agt1YS1wcm9maWxlcnINCxIEVGVzdBjr68MRDA?o=js";
63+
document.body.appendChild(script);
64+
}
65+
</script>
3066
</head>
3167
<body>
3268
<h1 id='qunit-header'>stacktrace.js Test Suite</h1>

0 commit comments

Comments
 (0)