Monday, 2 January 2017

Hack the JavaScript Evil Tester Sloganizer to Generate Random New Year's Resolutions

I wrote a blog post for the new year:
And in there I noted that if you go off to the Evil Tester Sloganizer
and type this code

for(var x=0;x<100;x++){
console.log("-" + process_sentence(sentences[30]));}

Then you’ll get a bunch of New Year’s Resolutions printed out to the console:

-I will try to pursue this risk further
-I resolve to scrutinize requirements
-I resolve to scrutinize ambiguity
-I think I might just exploit this defect further
-I will follow this risk further
-I think I might just provide alternative alternatives
-I will try to question more requirements
-I will learn to test effectively
-I resolved to scrutinize ambiguity
-I think I might just test the lifeblood out of this system
-I resolved to test the life out of this system

But what if, we want them to appear in the sloganizer itself?

Well, if instead of writing the console I wrote to the DOM, what would happen?



And what if we wanted a new resolution every second? Because we are such a flibbertigibbet that we can’t stick to anything?

Well, we’ve got you covered there too:

resolutionBot = setInterval(
}, 1000)

And when we are done, remember to stop it:


Exercise: As an exercise to the reader, the code above changes the DOM but doesn’t update the application status, so if you found a good slogan you couldn’t click Tweet This and have the system tweet it for you. See if you can change slogan to the result of process_sentence(sentences[30]) such that you could Tweet This if you wanted to.

No comments:

Post a Comment