Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
Experience Sitecore! | Using Onero with non-Sitecore websites - testing Transport for London website

Experience Sitecore!

Martin Miles on Sitecore

Using Onero with non-Sitecore websites - testing Transport for London website

Introduction

In this blog post I am going to demonstrate how you can test any custom website with Onero Page Runner. For our experiment I've decided to pick up Transport for London website located at http://tfl.gov.uk

  1. Creating a profile for a new website
  2. Populating Pages to process from a XML sitemap file
  3. Configuring Rules
  4. Configuring Forms
  5. Running and getting the results

1. Creating a profile for a new website

Onero configuration is based on testing profile. Using profiles it now becomes possible to create a combination of settings, rules and forms unique for for each individual profile and immediately switch between them just by selecting a profiles from a drop-down on a Settings dialog. Usually you would create a profile for one (or few) websites you would like to test with these settings. For our test we'll create a profile called Transport for London. 

Once created, the new profile immediately becomes active. You may change active profile by selecting a profile name from a drop-down as on a image below:

In fact, a profile is a folder with a profile name located on a drive, with its own combination of settings, rules and forms for submission. Changing active profile simply re-points Onero to use a folder with other settings.


2. Populating Pages to process from a XML sitemap file

On the next step we are going to load the list of pages to be tested. It can be also manually pasted into Page to process textbox, but we prefer to load links automatically from a XML sitemap file. Usually it is called sitemap.xml and is placed at the root of website. TFL website has such a file, and as soon as you specify address of that file into Load from xml sitemap textbox and hit Load Links button, Onero will process request and extract list of all the rages out of it. Sitemap file http://tfl.gov.uk/sitemap.xml references 1,374 pages and all they pre-populate the list, as per screenshot below. Also, as you may see, current profile name is displayed at реу window header.

If you hit Start button Onero will process loading all those pages, measure load timings and generate screenshots of every single page (if checked in configuration for current profile).


3. Configuring Rules

Despite is was already possible to run all the pages at the previous step, we now are going to add additional checks to ensure page is correct apart from it just loads correctly. This can be achieved through adding custom verification rules applicable to a specific (or all) pages. Clicking Rules button on the main window brings you the following dialog with all rules (for the current profile) listed.

Check-box on a screenshot below indicates whether a rule is enabled - only enabled rules are executed. [ALL] / [Incl] indicate a scope of rule execution - this is explained below.


This screenshot shows three rules and all they are enabled. The first one has [ALL] execution scope and thus will be executed on every single page; [Incl] for the second and third means that there are certain conditions that specify where exactly these rules are to be executed. Let's now create and configure these rules.

Rule in fact is a JavaScript code that returns a boolean or integer value. Rules is successful when condition clause returns boolean true or integer more than zero. For example you may return amount of elements satisfying some selector, so if more than one found - rule becomes successful. 
For websites that are run with jQuery you may benefit from writing conditions with its powerful selectors, as shown on screenshots below.

First two rules just return is amounts of element found are more than zero. The last rule return more complex combined condition, that checks if an element with specific id presents on a page and then compares the content of that element with expected message.

Please pay attention to Execution scope dropdown box - the one specifies where the rule will be executes. Three options are:
  • Everywhere - runs on every single page
  • Include - runs only on the pages from URL patterns field below
  • Exclude - runs on all the pages except those satisfying URL patterns field below
URL patterns to match store one oк multiple (comma separated) URL substrings to match. If URL has at least one of these patterns as a substring, Onero will run the rule for that page then. 

Please pay attention to a trailing '$'-dollar sign at the en of second and third patters; '$' means end of string. Thus a pattern http://tfl.gov.uk$ will match only landing page with this URL but does not match http://tfl.gov.uk/about. However, if you remove this trailing dollar sign - it will match all the pages on that domain name (because they all contain that URL pattern as a substring).
You can also delete any existing rules from that screen.


4. Configuring Forms

Similar to the rules, forms have their Forms List window, called by clicking Forms button at the main screen. It looks and functions exactly in the same manner. Double-clicking the form name opens it for edit.

Saying "forms" in his context means ability of Onero to find and populate on specific pages, submit them and analyze the results - whether form submission was successful. The last means that if form submission resulted with a confirmation message on a page - Onero is able to address that message and also check if its content matches expected. Alternatively, if form on a page redirects to a confirmation page, Onero can verify that as well and compare with expected redirect URL pattern.

Forms Editor has three logical sections: General (where to submit), Fields (what to submit) and Result match (how to verify).

URL Pattern works same as in rues - matching substring in URL will enable Onero to find and submit a form on that page.
Fields section set fields to find and populate. Field selectors have same syntax as CSS oк jQuery selectors - if it starts with # then it is ID of element, . specified class name, and omitting starting character will prompt Onero that it's an element tag name. In the last case Onero will ask you to confirm that behavior is desired, as it is less frequently used and very likely to be a mistakenly forgotten '#'or '.'


5. Running and getting the results

Onero updates the links with green / red color depending on results, as it processes them. There is also a progress-bar at the right bottom showing overall progress. 

Double clicking green or red link opens Page results for that specific URL, showing also which rules and forms have been executed on that page and their result codes. This is quite handy for cases when you see a URL turning red and would want to find out why exactly it becomes failed. The screenshots below show Page results for first three pages. You would probably notice different rules executed of each of them - that happens because of conditional URL pattern set previously at step (3).


Previewing results immediately is not the only way of inspecting results. At the end of testing process Onero generated report file with all the statistics for that test run. You may find that in reports.csv file located at Results folder within a folder with current settings profile name (Transport for London in our case). The quickest way to access this folder is to click Settings button from main screen and then Open folder button - it will open resulting folder in a separate Explorer window.

Results.csv spreadsheet contains detailed information about what pages have run and how quickly, what rules and form have been executed and their status codes. If Verbose setting is checked - all the results will be displayed (as on a screenshot below), otherwise only failed will be mentioned in that spreadsheet (that is handy as it prevents from informational noise especially on websites with thousands links and dozens of rules.


First column shows pages being executed, the second - rules and forms run on that specific pages with corresponding statuses at third column. Addons statuses column shows overall status for rules and forms executed and Page Status column shows the statuses for the page itself. They may not match, for example the page has loaded correctly and has Successful Page status, while one of its rules broke resulting Addons status to fail. Time to load shows time in milliseconds taken for page to load, rules and form are not mentioned in that figure.

I hope that quick guide managed to explain some basics of working with Onero and looking forward to your feedback!
blog comments powered by Disqus