Business Workflow
A Business Workflow is a sequence of steps that an end user performs with the application under test. Typically, you 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.
You can parameterize Workflow steps by passing data within quotes. You can then move the parameters around to improve readability of the test intent by Rephrasing the workflow steps.

Rename Business Workflow
You can change the name of your business workflow by using 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.
When you use 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
You can create a new stub method in the corresponding class by using 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. . You can access this option through the context menu.
This option allows you 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 you will notice 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 would prefer to include in your scenario. For instance, recording a workflow step on a web environment often embeds the html identifiers in your code. You may want 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 get modified.
Push To Implementation
The Push To Implementation in Twist is a specific operation that allows a user to achieve abstraction in the underlying implementation by grouping a set of workflow steps.
The selected workflow steps are grouped together, and you can choose to name this group of steps in a manner that reflects what these group of steps would achieve or test. The individual workflow steps re now replaced by one single step with the name you have chosen.
You will also notice that in the underlying code, that the grouped steps are included in a new method with the same name as the newly created workflow step.
