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.
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.
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.
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.
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.
