Sitecore 8 Content Testing – Add Tests to Workflow

How to Add Content Testing to Sitecore Workflow

To give the option to Content Test in workflow you need to create new Workflow Commands under a new or existing Workflow State, commonly the State before Item is publishable. In this example, the Content Test will be created on the Review State before the Item is moved to the Approved State for publishing.

Workflow Commands

First create two new Workflow Commands named ‘Approve with Test‘ and ‘Approve without Test‘ under the Workflow state that precedes the Publishable state.

The first Workflow Command is responsible for displaying the Test Editor to the User before ultimately moving the Item into the publishable State. The latter will remove all tests from the item and move it into the publishable state. To do this navigate to your workflow located under the folder at the path ‘/sitecore/system/Workflows‘ find the Workflow State, in this example Review.

Workflow Command Fields

Fields within a Workflow Command

In the new Workflow Commands add set both Next State fields to be the publishable State, e.g. Approved. For the ‘Approve with Test‘ Command set the Appearance Evaluator Type field to be the following class;

For the ‘Approve without Test‘ Workflow command add the following class to it’s Appearance Evaluator Type to the below

This is the Workflow we are aiming to achieve.

Sitecore Workflow with Content Testing

Workflow Actions

Now to wire-up the Test Editor so its displayed to the user when the Command ‘Approve with Test‘ is called. Right click on the ‘Approve with Test‘ Command click Insert from Template and choose the new Worfklow Action ‘Launch Create Test Dialog Action‘ located at the path ‘/sitecore/templates/System/Analytics/Testing/Workflow/Launch Create Test Dialog Action‘. The Action requires the following type in the Type string field;

A useful feature on this Action is the checkbox which will create a Suggested Test for the user is the wizard can not be displayed. This will use Sitecore’s automated testing to run tests it has determined to have the potential to add value to the Site.

Fields within a Workflow Action

Fields within a Workflow Action

Finally, for the ‘Approve without Test‘ State, create a Worfklow Action to delete any tests that may exist for the Item. Sitecore will handle this all for you by basing the Workflow Action on the ‘Template Remove Tests‘ Action located at the path ‘/sitecore/templates/System/Analytics/Testing/Workflow/Remove Tests Action‘ and the Type string field to be the value below. It is also worth using the delete the Test Definition to make your Test Lab clean of unwanted Tests.

The outcome of all your hard work will be displayed in the Workflow Chunk of the Review Tab will give the option to Approve with or without testing.

Sitecore Workflow Approve with Test

And that’s it!

That is all you have to do to enable Content Testing!

Get your Content Editors Testing what they are editing without a big change to their process. They can use your lovely new workflow to test the colour of that button they love so much.

Advertisements

7 thoughts on “Sitecore 8 Content Testing – Add Tests to Workflow

  1. Hi Jonathan,
    Thank you for the post it was helpful 🙂
    I am having an issue with the “preview and start test” popup is coming up with a blank screen. And the Start and Cancel button doesn’t do anything.
    Any help on this would be really appreciated.
    Thanks,
    Soni

    Like

      • Hi Jonathan,
        Thank you very much for your reply. I can see all the response code are coming back with 200 when I do a hard refresh but I noticed a javascript error in the console. Couldn’t see anything in the sitecore logs relating to the same. Does this js error suggest something?

        Uncaught TypeError: Cannot read property ‘initialize’ of undefined
        at child.addBehavior (sitecore-1.0.2.js:855)
        at sitecore-1.0.2.js:605
        at Array.forEach ()
        at Function._.each._.forEach (underscore.1.4.4.js:78)
        at child.views.View (sitecore-1.0.2.js:604)
        at child [as constructor] (sitecore-1.0.2.js:209)
        at child [as constructor] (sitecore-1.0.2.js:209)
        at new child (sitecore-1.0.2.js:209)
        at exposedComponent (sitecore-1.0.2.js:2581)
        at HTMLDivElement. (sitecore-1.0.2.js:2694)

        Thank you,
        Soni

        Like

      • Hi Jonathan,
        This issue is fixed. Apparently the presentation components of the popup were not properly setup. We were provided a raw value for that item from sitecore support. Once we replaced it worked fine.
        Thank you,
        Nimesh

        Like

  2. Pingback: Sitecore 8 Content Testing – Creating Multivariate and AB Tests | Exercising Sitecore

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s