Author: jbeard Date: Sat Jun 26 01:46:20 2010 New Revision: 958164 URL: http://svn.apache.org/viewvc?rev=958164&view=rev Log: Performance tests now work again.
Modified:
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/kitchen_sink/scripts/performanceTest.js
Modified:
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js
URL:
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js?rev=958164&r1=958163&r2=958164&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js
Sat Jun 26 01:46:20 2010
@@ -99,10 +99,7 @@ require.def("build",
//TODO: fix performanceTestScripts to requirejs, as is
now done with unitTestScripts
var performanceTestScripts = [
- {
- path :
"test/kitchen_sink/scripts/performanceTest.js",
- scxmlTest :
scxmlTests.KitchenSink_performance //back-link
- }
+ "test/kitchen_sink/scripts/performanceTest"
]
@@ -334,7 +331,6 @@ require.def("build",
function(testModulePath,step){
require([testModulePath],
function(testScript){
-
scriptsGenerated.
filter(function(s){return scxmlTests[s.scxmlTest] ==
testScript.scxmlTest}).
forEach(function(generatedScript){
@@ -437,73 +433,73 @@ require.def("build",
collect results
**/
runPerformanceTestsWithSelenium : function(){
- this.genPerformanceTestHtml();
+ this.genPerformanceTestHtml(function(){
+ print("Running Selenium
performance tests...");
- print("Running Selenium performance
tests...");
+ for(var browserName in
browsers){
- for(var browserName in browsers){
+ print("Running test for
" + browserName + "...");
- print("Running test for " +
browserName + "...");
+ var bSpec =
browsers[browserName];
+ var bSel = new
DefaultSelenium(bSpec.host, bSpec.port, bSpec.browser, seleniumConf.rootUrl);
+ bSel.start();
- var bSpec =
browsers[browserName];
- var bSel = new
DefaultSelenium(bSpec.host, bSpec.port, bSpec.browser, seleniumConf.rootUrl);
- bSel.start();
+
htmlPerformanceTestsGenerated.forEach(function(htmlTest){
-
htmlPerformanceTestsGenerated.forEach(function(htmlTest){
+ //ensure we are
not testing an ie html test
+ //on a non-ie
browser
+ if(htmlTest.ie
== bSpec.ie){
- //ensure we are not
testing an ie html test
- //on a non-ie browser
- if(htmlTest.ie ==
bSpec.ie){
+ var
performanceResult = [];
- var
performanceResult = [];
+ //we do
this 10 times
+ for(var
i = 0; i<10;i++){
- //we do this 10
times
- for(var i = 0;
i<10;i++){
+
var performanceResultString = testPerformanceWithSelenium(bSel,htmlTest.path);
- var
performanceResultString = testPerformanceWithSelenium(bSel,htmlTest.path);
+
//TODO: parse performanceResults from string into obj?
+
performanceResult.push(JSON.parse(performanceResultString));
+ }
- //TODO:
parse performanceResults from string into obj?
-
performanceResult.push(JSON.parse(performanceResultString));
- }
+
performanceResults.push({
+
data : performanceResult,
+
browser : browserName,
+
scxmlTest : htmlTest.scxmlTest,
+
backend : htmlTest.backend,
+ });
-
performanceResults.push({
- data :
performanceResult,
- browser
: browserName,
-
scxmlTest : htmlTest.scxmlTest,
- backend
: htmlTest.backend,
- });
+
//persist to file
+ var
fname = browserName +
+
"_" + "performance" +
+
"_" + htmlTest.scxmlTest +
+
"_" + htmlTest.backend + ".json";
- //persist to
file
- var fname =
browserName +
- "_" +
"performance" +
- "_" +
htmlTest.scxmlTest +
- "_" +
htmlTest.backend + ".json";
-
- print("Writing
performance results to " + fname);
-
utilFile.writeFile(performanceResultString,"build/" + fname)
- }
- });
+
print("Writing performance results to " + fname);
+
utilFile.writeFile(performanceResultString,"build/" + fname)
+ }
+ });
- bSel.stop();
- }
+ bSel.stop();
+ }
- //make one big, self-describing data
structure
- //this is what analyze uses to do its
analyses
- allPerformanceResults = {
- //FIXME: maybe make this an
obj, so that we can add more info to it (for reports, etc.)
- data : performanceResults,
- browsers : browsers,
- backends : backends,
- scxmlTests : scxmlTests
- };
-
- //stringify it, and serialize it for
posterity
- var allPerformanceResultsString =
-
JSON.stringify(allPerformanceResults)
+ //make one big, self-describing
data structure
+ //this is what analyze uses to
do its analyses
+ allPerformanceResults = {
+ //FIXME: maybe make
this an obj, so that we can add more info to it (for reports, etc.)
+ data :
performanceResults,
+ browsers : browsers,
+ backends : backends,
+ scxmlTests : scxmlTests
+ };
+
+ //stringify it, and serialize
it for posterity
+ var allPerformanceResultsString
=
+
JSON.stringify(allPerformanceResults)
- print("writing a summary of performance
results to " + performanceResultsPath);
-
utilFile.writeFile(allPerformanceResultsString,performanceResultsPath);
+ print("writing a summary of
performance results to " + performanceResultsPath);
+
utilFile.writeFile(allPerformanceResultsString,performanceResultsPath);
+ });
},
@@ -766,24 +762,29 @@ require.def("build",
}
- function
performanceTestHtmlTemplate(generatedJsCodeRelativePath,testScriptRelativePath){
+ function
performanceTestHtmlTemplate(generatedJsCodeRelativePath,testScriptModulePath){
default xml namespace = ""
return <html>
<head>
+ <script src="../lib/js/requirejs/require.js"
type="text/javascript">true;</script>
<script
src="../lib/test-js/dojo-release-1.4.2-src/dojo/dojo.js"
type="text/javascript">true;</script>
<script type="text/javascript"
src={generatedJsCodeRelativePath}>true;</script>
- <script src={testScriptRelativePath}
type="text/javascript">true;</script>
<script type="text/javascript">
- dojo.addOnLoad(function(){
- window.trial =
performanceTest(StatechartExecutionContext);
-
- window.trialString =
dojo.toJson(trial);
-
//console.log(window.trialsString);
+ require(
+ { baseUrl : "/" },
+ ["{testScriptModulePath}"],
+ function(performanceTest){
+
+ window.trial =
performanceTest.run(StatechartExecutionContext);
+
+ window.trialString =
dojo.toJson(trial);
+
//console.log(window.trialsString);
- window.testsComplete = true;
- });
+ window.testsComplete =
true;
+ });
</script>
+
</head>
<body>
<h1>Test</h1>
Modified:
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/kitchen_sink/scripts/performanceTest.js
URL:
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/kitchen_sink/scripts/performanceTest.js?rev=958164&r1=958163&r2=958164&view=diff
==============================================================================
---
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/kitchen_sink/scripts/performanceTest.js
(original)
+++
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/kitchen_sink/scripts/performanceTest.js
Sat Jun 26 01:46:20 2010
@@ -15,35 +15,38 @@
* limitations under the License.
*/
+require.def("test/kitchen_sink/scripts/performanceTest",
+{
+ scxmlTest : "test/kitchen_sink/KitchenSink_performance.xml",
+ run : function(scConstructor,ticToc){
-performanceTest = function(scConstructor,ticToc){
+ var d1 = new Date();
- var d1 = new Date();
+ sc = new scConstructor()
- sc = new scConstructor()
+ sc.initialize();
- sc.initialize();
+ sc.t1()
- sc.t1()
+ sc.t2_7()
- sc.t2_7()
+ sc.t3()
- sc.t3()
+ sc.t4_9()
- sc.t4_9()
+ sc.t5()
- sc.t5()
+ sc.t2_7()
- sc.t2_7()
+ sc.t8()
- sc.t8()
+ sc.t4_9()
- sc.t4_9()
+ var etime = new Date() - d1;
- var etime = new Date() - d1;
-
- //return an array of times
- //index 0 is initialization time
- //FIXME: maybe way want labels for this data? Might be easier to
analyze later...
- return etime;
-}
+ //return an array of times
+ //index 0 is initialization time
+ //FIXME: maybe way want labels for this data? Might be easier
to analyze later...
+ return etime;
+ }
+});
