Skip to content

Commit

Permalink
Collect statistics for commands
Browse files Browse the repository at this point in the history
  • Loading branch information
samitbadle committed Sep 29, 2014
1 parent c4d6615 commit 8844901
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ide/main/src/content/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ function Debugger(editor) {
}
});
this.runner.testCase = this.editor.getTestCase();
this.runner.updateStats = function (command) {
editor.health.increaseCounter('commands', command);
};

const subScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
//subScriptLoader.loadSubScript('chrome://selenium-ide/content/selenium-core/selenium-logging.js', this.runner);
Expand Down
24 changes: 24 additions & 0 deletions ide/main/src/content/selenium-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,30 @@ objectExtend(IDETestLoop.prototype, {
if (this.handler && this.handler.testComplete) this.handler.testComplete(failed);
},

// overide _executeCurrentCommand so we can collect stats of the commands executed
_executeCurrentCommand : function() {
/**
* Execute the current command.
*
* @return a function which will be used to determine when
* execution can continue, or null if we can continue immediately
*/
var command = this.currentCommand;
LOG.info("Executing: |" + command.command + " | " + command.target + " | " + command.value + " |");

var handler = this.commandFactory.getCommandHandler(command.command);
if (handler == null) {
throw new SeleniumError("Unknown command: '" + command.command + "'");
}

command.target = selenium.preprocessParameter(command.target);
command.value = selenium.preprocessParameter(command.value);
LOG.debug("Command found, going to execute " + command.command);
updateStats(command.command);
this.result = handler.execute(selenium, command);
this.waitForCondition = this.result.terminationCondition;
},

pause: function() {
// editor.setState("paused");
setState(Debugger.PAUSED);
Expand Down

0 comments on commit 8844901

Please sign in to comment.