
|
If you were logged in you would be able to see more operations.
|
|
|
Selenium
Created: 10/Mar/08 12:16 PM
Updated: 10/Mar/08 12:16 PM
|
|
| Component/s: |
Logging
|
| Affects Version/s: |
0.8.3
|
| Fix Version/s: |
None
|
|
|
Original Estimate:
|
Unknown
|
Remaining Estimate:
|
Unknown
|
Time Spent:
|
Unknown
|
|
|
Adding execution times in the output can be very useful.
Here is how I did add them in selenium-testrunner.js (SVN patch).
Note that I used attributes to save the information, and 13 lines were modified (one ; was missing on a line).
At the end of the test, the HTML output will contain an attribute elapsedtime, which contains the number of milliseconds of every instruction.
The tests have an attribute duration that contains the number of seconds of its execution.
Index: selenium-testrunner.js
===================================================================
--- selenium-testrunner.js (revision 2010)
+++ selenium-testrunner.js (working copy)
@@ -486,6 +486,11 @@
setText(this.trElement.cells[2], message);
},
+ setElapsedTime: function(elapsedTime)
+ {
+ this.trElement.setAttribute('elapsedTime', elapsedTime);
+ },
+
reset: function() {
this.setStatus(null);
var thirdCell = this.trElement.cells[2];
@@ -564,7 +569,7 @@
}
},
- saveTestResults: function() {
+ saveTestResults: function(elapsedTime) {
// todo: GLOBAL ACCESS!
var resultHTML = this.testFrame.getDocument().body.innerHTML;
if (!resultHTML) return;
@@ -572,6 +577,7 @@
// todo: why create this div?
var divElement = this.trElement.ownerDocument.createElement("div");
divElement.innerHTML = resultHTML;
+ divElement.setAttribute('duration', elapsedTime);
var hiddenCell = this.trElement.ownerDocument.createElement("td");
hiddenCell.appendChild(divElement);
@@ -643,7 +649,7 @@
},
unselectCurrentRow: function() {
- var currentRow = this.getCurrentRow()
+ var currentRow = this.getCurrentRow();
if (currentRow) {
currentRow.unselect();
}
@@ -662,6 +668,7 @@
_startCurrentTestCase: function() {
this.getCurrentRow().loadTestCase(fnBind(htmlTestRunner.startTest, htmlTestRunner));
+ this.testStartTime=new Date().getTime();
},
_onTestSuiteComplete: function() {
@@ -671,7 +678,8 @@
updateSuiteWithResultOfPreviousTest: function() {
if (this.currentRowInSuite >= 0) {
- this.getCurrentRow().saveTestResults();
+ var curTime = new Date().getTime();
+ this.getCurrentRow().saveTestResults(Math.floor((curTime - this.testStartTime)/1000));
}
},
@@ -1112,6 +1120,7 @@
sel$('pauseTest').disabled = false;
this.currentRow.select();
this.metrics.printMetrics();
+ this.commandStartTime=new Date().getTime();
},
commandComplete : function(result) {
@@ -1125,6 +1134,8 @@
} else {
this.currentRow.markDone();
}
+ var curTime = new Date().getTime();
+ this.currentRow.setElapsedTime(Math.floor(curTime - this.commandStartTime));
},
_checkExpectedFailure : function(result) {
|
|
Description
|
Adding execution times in the output can be very useful.
Here is how I did add them in selenium-testrunner.js (SVN patch).
Note that I used attributes to save the information, and 13 lines were modified (one ; was missing on a line).
At the end of the test, the HTML output will contain an attribute elapsedtime, which contains the number of milliseconds of every instruction.
The tests have an attribute duration that contains the number of seconds of its execution.
Index: selenium-testrunner.js
===================================================================
--- selenium-testrunner.js (revision 2010)
+++ selenium-testrunner.js (working copy)
@@ -486,6 +486,11 @@
setText(this.trElement.cells[2], message);
},
+ setElapsedTime: function(elapsedTime)
+ {
+ this.trElement.setAttribute('elapsedTime', elapsedTime);
+ },
+
reset: function() {
this.setStatus(null);
var thirdCell = this.trElement.cells[2];
@@ -564,7 +569,7 @@
}
},
- saveTestResults: function() {
+ saveTestResults: function(elapsedTime) {
// todo: GLOBAL ACCESS!
var resultHTML = this.testFrame.getDocument().body.innerHTML;
if (!resultHTML) return;
@@ -572,6 +577,7 @@
// todo: why create this div?
var divElement = this.trElement.ownerDocument.createElement("div");
divElement.innerHTML = resultHTML;
+ divElement.setAttribute('duration', elapsedTime);
var hiddenCell = this.trElement.ownerDocument.createElement("td");
hiddenCell.appendChild(divElement);
@@ -643,7 +649,7 @@
},
unselectCurrentRow: function() {
- var currentRow = this.getCurrentRow()
+ var currentRow = this.getCurrentRow();
if (currentRow) {
currentRow.unselect();
}
@@ -662,6 +668,7 @@
_startCurrentTestCase: function() {
this.getCurrentRow().loadTestCase(fnBind(htmlTestRunner.startTest, htmlTestRunner));
+ this.testStartTime=new Date().getTime();
},
_onTestSuiteComplete: function() {
@@ -671,7 +678,8 @@
updateSuiteWithResultOfPreviousTest: function() {
if (this.currentRowInSuite >= 0) {
- this.getCurrentRow().saveTestResults();
+ var curTime = new Date().getTime();
+ this.getCurrentRow().saveTestResults(Math.floor((curTime - this.testStartTime)/1000));
}
},
@@ -1112,6 +1120,7 @@
sel$('pauseTest').disabled = false;
this.currentRow.select();
this.metrics.printMetrics();
+ this.commandStartTime=new Date().getTime();
},
commandComplete : function(result) {
@@ -1125,6 +1134,8 @@
} else {
this.currentRow.markDone();
}
+ var curTime = new Date().getTime();
+ this.currentRow.setElapsedTime(Math.floor(curTime - this.commandStartTime));
},
_checkExpectedFailure : function(result) {
|
Show » |
| There are no comments yet on this issue.
|
|