SiteUpValidation
Aus ExpeccoWiki
Motivation
Recently, I wanted to visit one of my current favourites (http://projecteuler.net) only to get the following frustrating response:
Well, obviously, they have a mySQL problem from time to time. As I was eager to get my next problem-solution verified, I started to press reload every few minutes to see if the problem was fixed. I did this for a while, until I got tired and thought "well, that's a task for expecco...".
Automated Solution
So, here is the requirement:
in a loop, repeated every few minutes, connect to projecteuler, see if the "not connect to MySQL" string is present if it is present, repeat the loop if it is not present, ring a bell, open a notifyer dialog, and finish.
The interaction with the website is done via a captured and imported web-session activity:
start a selenium capture; navigate to the website; select the "not connect to MySQL" string, and choose the "assert text present" menu item. click on the "import to expecco" button.
So, after the capture, this is the sequence of steps as recorded; in selenium we see:
Back in the expecco application, refactor the just imported activity and replace the "assert text present" by an "is test present" step. In contrast to the "assert"-block, the "is-present"-block does not stop the execution with a failure. Instead, it provides separate true/false outputs. Also drag a connection from the yes/no outputs of this new "is text present"-block to the right output pin area of the compound to create new output pins. This gives me a reusable block, with euler-is-good/euler-is-bad output pins.
After the import-into-expecco, and above changes, this is how the above actions look like in expecco:
A "playSound" block is currently missing in the StandardLibrary (it will be added in the future), so I added the following parameterless elementary:
execute
Display beep.
finally, in another compound block, place the captured check-block, the play-sound block and a notifier dialog. Then these are connected as shown below:
finally, place that into a testplan, check the "Repeat Until Success" toggle and let it run...
Please note that the "Repeat Until Success" is only available in expecco versions from 1.6. If you have 1.5, invert the logic and repeat until "error" as a workaround.
Happy WebSite Checking !
Download
Here is the project to be loaded into expecco: http://wiki.expecco.de/images/e/e8/CheckProjectEulerSiteWorking.ets
Back to Examples.
