Business Workflow
A Business Workflow is a sequence of steps that an end user performs with the application under test. Typically, one would assert or verify something about the system after some actions are performed.
A Business Workflow has an underlying code associated with it. The actual mechanics of driving the application is done in the code.
Create Business Workflow
Workflows are represented in the scenario editor as a bulleted list. If a workflow step fails when a scenario is executed, the execution of that scenario stops and the scenario execution is marked as failed.
It is advisable to specify the workflow steps in a way that is not closely tied to the underlying user interface of the application, as this can make the scenario fragile.
Workflow steps can be parameterized by passing data within quotes. The parameters can be moved around by Rephrasing the workflow steps.

Rename Business Workflow
Workflows can be renamed by using the Rename option available in the Context Menu. This renames the Workflow's name and also renames the underlying implementation.

Using Content Assist
Twist provides Content Assist facility that suggests possible actions at the point of invocation. Content Assist can be invoked by pressing Ctrl+Space.
While using Content Assist the list drawn will contain a list of available workflow steps project-wide. These steps can be further filtered based on the text typed in and on choosing the step, the workflow containing the step itself is added onto the scenario.

Generate Code using Quick Assists
Create Method Quick Assist which is invoked by Ctrl+1 and by pressing Return, or by selecting QuickFix from the context menu will create a new stub method in the corresponding class.
Create Stub Methods and Classes
Twist generates stub methods and classes for the workflow steps created. The option Quick Assist is used to get Twist to create code when it does not yet exist. It is invoked by Ctrl-1 or by selecting Quick Fix from the context menu.

Refactoring
Rephrase Workflow Steps
The Rephrase Step in Twist is a combination of Rename and Change Method Signature. This option can be accessed through the context menu.
This option allows the user to
- modify the name of a workflow step
- change the order of parameters
- add a parameter
- remove a parameter
Once any or all these changes are performed it can be noticed that the workflow step has been updated in both the scenario as well as the Java code.
Introducing parameters from underlying Fixtures
Often you have constants in your fixture code that you wish were in your scenario. For instance, recording a workflow step in a web environment often embeds the html identifiers in your code. Say, you would like to introduce those identifiers as parameters in your workflow step.
As an example, consider the following scenario:Workflow:
- buy book of Agatha Christie
public void buyBookOfAgathaChristie() {
application.buyBook("Five little pigs");
}
You can use Introduce Parameter Refactoring in the underlying work flow step method which
automatically inserts the parameter in the corresponding Workflow step as well.
If you select "Five little pigs" and use the Introduce Parameter option in the Refactoring options in Context Menu, you would see that the underlying code changes as follows:
public void buyBookOfAgathaChristie(String string1) {
application.buyBook(string1);
}
If you now go back to the Scenario, you would observe that the Scenario is modified as follows:
Workflow:
- buy book of Agatha Christie "Five little Pigs"
When you Introduce a Parameter in the underlying code, all scenarios that use the underlying code gets modified.
Extract Concept
The Extract Concept in Twist is a specific operation that allows a user to group and reuse a set of workflow steps.
The selected workflow steps are grouped as one concept and are replaced by the name of the concept as a workflow step.
In the underlying code, it can be noticed that the grouped steps are included in a new method with the same name as the newly created concept.
