js monkey patch-override, after
by John Wick
HTML
// reference: http://me.dt.in.th/page/JavaScript-override/
JavaScript
// console.clear();
console.log(" ");
function Tester() {
}
Tester.prototype.saveResults = function(filepath) {
console.log('Save test result to ' + filepath)
}
Tester.prototype.run = function() {
console.log('Running tests...')
this.saveResults('test.xml')
}
var test = new Tester()
var originalSaveResults = test.saveResults
test.saveResults = function(filepath) {
var returnValue = originalSaveResults.apply(this, arguments);
var planpath = filepath.replace('.xml', '_plan.xml');
console.log('Save test plan to ' + planpath);
return returnValue;
}
test.run()