3 * - Run button/index.html -> buttonMarkup/index.html automatically in one browser
4 * - Summarize result of each test suite
5 * - pass current summary data by GET variables
6 * - Get current summary data by parsing URL to get those GET variables
9 * - Some testcases may change URL during test
10 * It is a not complete versionc. Optimization, refactoring is needed
14 var QueryString = function () {
15 var query_string = {},
19 query = window.location.search.substring(1);
21 vars = query.split("&");
23 for (var i = 0 ; i < vars.length ; i++)
25 pair = vars[i].split("=");
26 if (typeof query_string[pair[0]] === "undefined")
28 query_string[pair[0]] = pair[1];
30 else if (typeof query_string[pair[0]] === "string")
32 arr = [ query_string[pair[0]], pair[1] ];
33 query_string[pair[0]] = arr;
35 query_string[pair[0]].push(pair[1]);
41 except : listview, event
70 passCount, failCount, totalCount, runtime,
74 function getCurrentURL ( ) {
75 return window.location.href;
77 function getURLParameter(name) {
79 (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
82 url = getCurrentURL( );
84 ( function parseURL ( url ) {
88 passCount = ( typeof QueryString.p === "undefined" ) ? 0 : parseInt( QueryString.p );
89 failCount = ( typeof QueryString.f === "undefined" ) ? 0 : parseInt( QueryString.f );
90 totalCount = ( typeof QueryString.t === "undefined" ) ? 0 : parseInt( QueryString.t );
91 runTime = ( typeof QueryString.r === "undefined" ) ? 0 : parseInt( QueryString.r );
93 loc = window.location.pathname;
94 dirs = loc.substring(0, loc.lastIndexOf('/')).split('/');
95 currentTest = dirs[dirs.length-1];
97 QUnit.log = function( obj ) {
100 if ( tempUrl.indexOf("?")>-1 ) {
101 tempUrl = tempUrl.substr(0,tempUrl.indexOf("?"));
103 $.post( tempUrl + "../../../../../../tests/jqm-tchelper/log.php", { currentTest : currentTest, obj : obj } , function(){});
106 QUnit.done = function ( details ) {
109 function getNextTestURL( currentTest, passCount, failCount, totalCount , runTime ) {
113 for( i = 0 ; i < tests.length ; i++ )
115 if( tests[i] == currentTest )
121 if( tests.length -1 == i ||
122 currentTest === "listview" ||
123 currentTest === "event" )
126 nextUrl ="../../../../../../tests/jqm-tchelper/result.php" + "?" + "p=" + passCount + "&f=" + failCount + "&t=" + totalCount + "&r=" + runTime;
128 if( currentTest === "navigation" )
132 nextUrl = updir + tests[i + 1] +"/?" + "p=" + passCount + "&f=" + failCount + "&t=" + totalCount + "&r=" + runTime;
137 function gotoURL( url ) {
138 window.location.href = url;
142 passCount += details.passed;
143 failCount += details.failed;
144 totalCount += details.total;
145 runTime += details.runtime;
147 nextTestURL = getNextTestURL( currentTest, passCount, failCount, totalCount ,runTime );
148 gotoURL( nextTestURL );