DéjàClick Script Branching

Overview

Branching Logic is a DéjàClick feature that allows a web transaction script to use conditional tests to branch if specific conditions are met. There are many circumstances under which you may want to navigate to alternate web pages in one transaction, for example:

  • Out-of-inventory condition – When you are monitoring your order processing flow and an item is out of stock, you don't want the transaction to report an error. Instead, you want the script to handle it elegantly and report success. You can set up a branch that will select an alternate item if the first one isn’t available.
  • A/B testing – When your organization performs A/B testing, your monitor won’t be able to predict which page will be served. In that case, you can set up branches that key in on a known object in each of the versions and have your script kick off the appropriate path based on what it has been served.
  • Conditional monitoring – You can monitor your mobile site by first entering the main domain. If there is an issue on the main site, the replay will stop without error notification since it couldn’t execute the mobile test.
  • Maintenance mode – You can set up breakpoints at pages undergoing maintenance or changes, record a new series of steps, and set the branching rule to take that path temporarily. When the changes have been completed, the branching rule can be removed and the added steps will be ignored.
  • Script editing - You want to completely change the last three steps of your script. Instead of having to re-record the script from the changed event on down, now you can add a branch with the new events, or add a branching rule to skip events that need to be deleted.

DéjàClick Script Branching facilitates the handling of these situations and others. Branching lets you specify when certain error conditions on certain events should be ignored, so that when those errors occur, the transaction will not raise an error but will continue on to the next event. Branching also provides the option of skipping events, jumping forward to another event, or stopping replay before the end of the script is reached. Finally, Branching includes the option of recording a new "branch", which is an alternate sequence of events that can be replayed as part of the main script.

The addition of branching in DéjàClick requires the use of some decision logic so that a script could include multiple recorded sequences of events and the conditional logic would decide between them at replay time. This means that DéjàClick could replay a different sequence of events each time the transaction runs.

Familiarity with AlertSite's DéjàClick transaction recording tool is strongly recommended for using this guide. If you don't have the DéjàClick toolbar in your Firefox browser, go to the DéjàClick Downloads page to download the DéjàClick add-on and additional modules (TrueScreen and ImageMagick). If you have never used DéjàClick before, please go to the DéjàClick Quick Start Guide. After you have become comfortable with recording DéjàClick transactions, you'll be able to move on to this more advanced feature.

Note: Branching Logic is not currently supported on InSite Private Monitoring Locations or with the Internet Explorer browser.

Configuration Process

It is advised that you spend some time designing the logic flow of your transaction. A flowchart or decision table can help you visualize how you expect to navigate through the website depending on conditions. Once you have a good handle on the process, it will make recording and branching configuration easier.

To utilize Branching, open the Script Properties Sidebar and set the DéjàClick Display Level to Advanced to show the Branching Rules panel at the bottom.

Branching_rules_sidebar.PNG

The Branching Rules panel is available for both Actions and Events.

When you pause during script replay, you will be able to insert a target branch that will be taken depending on conditions you select within the Branching Rules.

The general procedure is outlined as follows:

  • Record the main leg of your transaction
  • Right-click on the Action or Event you want to stop at and click Pause
    Pause.PNG
    Alternatively, click on the down-arrow next to the Replay button, select Replay Next Action
    Replay_dropdown.PNG
    then click Replay until you arrive at the Action you want to branch from.
  • When paused, click the down-arrow next to the Record button to show 2 selections:
    Record_dropdown.PNG
    Select Add to new branch to create a branch with a new set of steps to execute.
  • Click Record to create the branch with the new steps.
  • Set up a Branching Rule based on a specific condition to control which part of the script to play.
  • Repeat RecordAdd New Branch for additional branches.

Back to top

Illustration

You want to exercise your web application's Item Search functionality. You want to make sure that the page displays "item is available" if the search term is found; otherwise, it will display "out of stock". The basic flow is:

  • If the item is found, you'll select the item, then proceed to the shopping cart.
  • If the item is not found, then you'll select a second-choice alternative.
  • If that item is not found, you'll go to the "Contact Us" page.

The sections below will show how to implement Branching in the transaction to accomplish the desired logic flow. Please note that this example is for illustration only and does not refer to any specific website application.

Record the Transaction

To set up this scenario, first record the initial search.

Search for First Choice Item

  • Click Record button in the DéjàClick toolbar
  • Enter starting URL and go
  • Enter the item you want into the Search box and go
  • When the item page is displayed, click the Validation button in the DéjàClick toolbar to open the validation pane below the toolbar and select Keyword
  • Hover over "item is available" on the page, then click to select it
  • Click the Validation button again to close the validation pane
  • Click to select the item and proceed to the shopping cart
  • Click the Stop record/replay button

The main part of your script is now done. To perform a search for the alternate item, you'll want to navigate to a different set of steps. You can add a branch to do that search by replaying the main script and stopping at the Action where you enter the search term.

Create a Branch for the Second Choice Item Search

  • Right-click on the Action where the initial search was entered and click Pause so that replay stops there
  • Click the Replay button in the DéjàClick toolbar
  • When replay stops at the search Action, click the down-arrow next to the Record button, and select Add to new branch
  • Click the Record button - [Branch 1] will appear at the bottom of the script tree in the sidebar

The Branch starts a new section and queues you there. You're now ready to record the steps for the alternate item.

Search for Second Choice Item

  • Click in the Search box to look for the alternate item
  • Enter the alternate item and go
  • When the item page is displayed, click the Validation button in the DéjàClick toolbar (Keyword is already selected)
  • Hover over "item is available" on the page, then click to select it
  • In the Add Keyword Validation dialog, click OK
  • Click the Validation button to close the validation pane
  • Click on the item to select it and proceed to the shopping cart
  • Click the Stop record/replay button

Now you have the second part of your script done. The third part of the transaction, what to do when the second-choice item is out of stock, will go to the Contact Us page. Simply record another Branch that navigates to Contact Us.

Neither Item Exists - Contact Customer Service

  • Click the Replay button in the DéjàClick toolbar
  • Replay stops at the search Action because the Pause is still in place from the first Branch
  • Click the Record button (Add to new branch is still selected)
  • Click the Contact Us link in website header, footer, or sidebar
  • Click the Stop record/replay button

DONE! The script has been recorded with the steps that will be taken based on the search results during regular replay. Now it's time to add the Branching Rules that the transaction will follow.

Back to top

Add Branching Rules

Branch 1: First-Choice item not found

  • In the script tree, click on the Action that does the search of the first-choice item.
  • In the Properties section of the sidebar, scroll to the bottom and click Branching Rules.
  • Click the Add button to display the Add Branching Rule dialog

    Add_branching_rules_dialog.PNG
  • Enter a description of the rule in the Name: field.
  • Select the "trigger" from the dropdown

    Branch_when_mod.PNG
    We will select Replay status is (the Status Code selection dropdown is hidden if Always or Never is chosen)
  • Choose the Status Code to trigger on:

    Status_Code_for_branch.PNG
    In our example, we want to branch when the keyword validation fails.
  • Select the action to perform: Stop Replay or Jump to

    Do_this.PNG
    We want to jump to a different part of the script.
  • The next selection is a dropdown that will change depending on the existence of other branches and how many there are:

    Branch_to.PNG
    We would select Branch 1 for this condition.
  • Select whether you want to branch to the Action or Event within the main script or branch

    Action_Event.PNG
    The valid selections are displayed in the dropdown.
  • We can also specify the Action or Event number to branch to:

    Action_number.PNG
    This number changes depending on the Action or Event selection.
  • You can have more than one Branch Rule, depending on your requirements. In that case, you can set their sequence order:

    Sequence.PNG
    If there is only one branching rule, this field does not appear.
  • Click Apply

Branch 2: Second-Choice item not found

  • In the script tree, click on the first Action in Branch 1
  • Click Branching Rules in the Properties section of the sidebar
  • Click the Add button to display the Add Branching Rules dialog
  • Enter the description in the Name: field
  • Select the "trigger", Replay status is
  • Choose 5) Validation Failed
  • In Do this:, Jump to - Branch 2 - Action 1
  • Click Apply

Next, you'll want to test the branching logic for the conditions you've set to make sure it performs as expected. This requires manipulating the script properties, in this example the Event Input, so that the conditions will be met during replay.

Back to top

Test Branching Logic

First Choice Found

  • Remove the Pause by right-clicking on the Action with Pause enabled and click Pause to de-select it
  • Click the Replay button
  • The script will replay through the main script and complete

First Choice Not Found, Second Choice Found

  • In the script tree, click the Event Input HTML Element <INPUT> under the Action where you made your first selection
  • In the Properties sidebar, open the Event Input panel
  • Change the text, which was the item you searched for, to some random characters
  • Click Apply
  • Click Replay in the DéjàClick toolbar

You'll see the progress in the script tree as the transaction is replayed. When it gets to the Event that does the keyword validation for "item is available", it will fail because the event input, now random characters, will not be found. The main script Branching Rule says: when keyword validation fails, Jump to Branch 1 Action 1. This is the section to search for the alternate choice. You will see the progress icon, a green checkmark, skip to Branch 1. The steps in this branch will be executed and the script will complete.

Now it's time to test the logic if the alternate choice isn't found.

  • In the script tree, click the Event Input HTML Element <INPUT> under the Branch 1 Action 1 where you made your alternate selection
  • In the Properties sidebar, open the Event Input panel
  • Change the text, which was the item you searched for, to some random characters
  • Click Apply
  • Click Replay in the DéjàClick toolbar

As the transaction is replayed, you'll see it progress from the main script to Branch 1, where the keyword validation "item is available" will fail when the Event is checked. The Branch 1 Branching Rule says: when keyword validation fails, Jump to Branch 2 Action 1. The rule for that Event causes execution to jump to Branch 2, and the script will complete.

When you are satisfied that the transaction performs all branches as expected, return to the Properties sidebar and restore the correct text strings in both Event Input panels that were changed.

Note: Replay will automatically stop when it reaches the end of a script, whether the main script or a branch.

Upload to Account

Now that the transaction is set up to handle the two possible conditions you expect, you can upload it to your AlertSite account for monitoring.

  • Click on the blue Remote Services button in the DéjàClick toolbar
  • Click AlertSite Login and provide your account credentials
  • Click on the Remote Services button to select Upload Recording
  • Fill in the information in the Upload Recording dialog and click OK
  • The Manage Transaction page will appear in a new browser tab; modify any of the fields as needed and click Submit

The Dashboard will update shortly with the monitoring data for the new transaction.

Helpful Tips

  • Looping is not allowed. You cannot jump back to a previous event within the main part of the script or within a branch. You can:
    • jump forward to a later event in the main part of the script or in a branch
    • jump between the main part of the script and a branch
    • jump between branches.
  • You will not be able to add a branching rule to the last event of a script that does not have at least one branch. Otherwise, the Target section of the Add Branching Rules dialog for that event will be grayed out since there are no valid targets to jump to. You can, of course, add a branching rule to any of the previous events in the script as long as it jumps forward to a later event.

 

Back to top