In strict mode, this
will be undefined inside an immediate function like that, and not the global object (which it would be without strict mode). One way to make your code work is to create the global variables explicitly (if that's what you're looking for):
window.run = function(casper) {
// code test here
};
window.run(casper);
Or, if you're not looking for globals, just declare your method locally:
var run = function(casper) {
// code test here
};
run(casper);