A Simon filters case study

Before I moved the Dejal blog to WordPress, I had a test that was bundled with Simon called “Dejal posts” (you may still have this if you’re a long-time customer). This was a great example of using multiple filters to narrow down the output of a Web Page service. While the URL it monitored is no longer valid, it remains a useful example for you to learn more about creating your own filters.

The general idea of this test was to look at a “Recent Posts” page of the Dejal site, which listed all recent blog, forum, FAQ etc posts and their comments, and output some tidy text describing the most recent one, along with a changed state when a new post or comment is added.

Firstly, here’s the Service page; nothing remarkable here (the cookies are automatically recorded, and unimportant for this test):

Service

The most interesting page is the Filters one:

Filters

When you check the test and look in the Activity log, you can see the output from each of those filters (from bottom to top):

Activity

Another way to view the output is via the Preview pane, which includes not only the service response and headers, but also the full output of each filter, to help you diagnose each step.

Here’s the output of the service; the full HTML of the web page:

Preview0

Let’s break down each of the filters, via the Preview filter output.

The first filter, a Block one, takes the service response as its Input, and has Start text of <tbody> and End text of <td class="replies">. This finds the first occurrence of each of those bits of HTML in the service response, which corresponds with the most recent post information:

Filter1

This filter outputs that:

Preview1

The second filter is another Block one. It takes the output of the first filter as its input, and narrows it down further to just the title of the post. Notice that it also uses options disclosed on the right-hand-side of the filter configuration: it looks for the second occurrence of the Start text, searching from the beginning of the input:

Filter2

The output of this filter is the post title:

Preview2

The third filter is yet another Block (it is one of the most useful filters), but the input is different: this time it uses the output of the first filter, instead of the previous one (as is the default). It also has an option to look for the third occurrence:

Filter3

It extracts the author information:

Preview3

Filter number four is different. It uses an Ignore Links filter to extract out just the author name from the previous filter output. The previous filter doesn’t do this as when you were not logged in on the Dejal site, only the name is included (in which case this filter has no effect):

Filter4

The output is just the non-HTML part of the input:

Preview4

Next we’re back to a Block filter again, but this time looking at the original service response text to extract the number of replies to the post:

Filter5

This should always output a number:

Preview5

We then use a Singular or Plural filter, to take the number found in the previous filter and output “reply” if it is one, or “replies” for any other number:

Filter6

As seen in the preview:

Preview6

The last filter puts it all together: an Override Custom filter uses variables to combine the output of several filters in a nice readable way. In this case all the variables are variations of the filter output, but other variables are available too. Something that isn’t immediately obvious is that you can insert numbers to reference specific filters (otherwise it refers to the previous one):

Filter7

Which results in:

Preview7

So now that we’ve got some nice output text, what do we do with it? Of course, you can just see it in the Tests list, if you have the last change and failure displayed:

Tests

But you’ll probably want to get a notification:

Notifiers

I hope this case study is helpful. Most tests don’t need a series of filters like this, and there are other ways to achieve similar effects (like writing all the logic in a script), but it can be very useful when you want it. You can use similar techniques in your own tests.

How can I play a sound during a break in Time Out?

To play a sound or perform other actions before, during, or after a break, check out the Actions page of the break editor:

Actions page

Other actions include the ability to display a notification (with an optional sound), fade out the currently playing sound (useful at the end of the break), flash the screen, and speak some text with speech synthesis. Several scripts are provided, too.

To add an action, simply click the + button in the top-right corner of the window, to display a menu of available actions:

Add action menu

(When you first click this button, the scripts won’t be there, and there will just be “More…” item at the end; choose this to install the scripts.)

The first bunch are the various actions, followed by scripts, which are like customizable actions. At the end of the menu are items to open the Scripts folder in the Finder, so you can edit or add scripts, and go to the Time Out Extras page to download more scripts.

Once you add an action, you’ll see a header row with the name of the action and some other controls:

Action header

You can use the interval picker and pop-up menu to indicate when to use the action. The interval picker enables you to offset from the action stage by a number of seconds, minutes or even hours (click on the units to change them). Instead of just being able to play a sound at the start and/or end of a break, you can choose from many more times, including before due, after skipping, and more:

Action when menu

After those controls is a Preview (Preview) button, that will demonstrate the action. And a Remove (Remove) button to remove the action.

Here is a brief video to demo the feature: adding a Play Sound action to play a long music track, and a Fadeout Sound action to make it fade out when the break successfully finishes. (You might instead want to have it fade out for any end, otherwise it’d keep playing till done if you skip.)

This is a powerful and flexible feature of the app, especially when using custom scripts.

On vacation

Please note that I’ll be on vacation for the next couple of weeks, with unknown internet access, so support queries may be delayed. Please post to the /r/Dejal community on Reddit, so others may be able to assist.

My wife and I will be dropping off our motorhome for servicing, our cat Paladin for boarding, and will be catching flights for the first time in years, heading to the US Virgin Islands to celebrate Jenn’s milestone birthday.

Paladin

No doubt I’ll take lots of photos, and will do posts on my Sinclair Trails blog once we’re back, so you can look forward to that.

Next Dejal post on the 21st. See you then!