Add assertions
Add assertions to verify that the job is executing as expected.
You can add assertions at any point to check for the pending activities, a variable value, process state, activity assignment, and event. You can also check for the details of the pending activities within an embedded process or subjob.
Assertions are based on the current point of the process using variable values, states, and more. If you add an assertion at the point when execution is within a sub job, the data from the subjob is used.
You can add multiple assertions of the same or different types. For example, activity status and variable assertions can be used in the same test script but not in the same assertion.
You can modify an assertion when the execution has stopped at a point. You can delete an assertion.
To add an assertion, on the test case viewer page, on the Execution path tab, click Add assertion. The Add assertion dialog box is displayed. You can add the following assertion types: Activity, Event, State, and Variable value.
Add an activity assertion
Add an assertion on an activity status (only pending) and activity assignment in the parent job or active subjob or embedded process.
- In the Add assertion dialog box, on the Assertion type list, select Activity.
-
Click
Add activity.
The Select activity dialog box is displayed.
-
On the
Activity name list, select the activity, for example, Activity1.
You can select an activity from the currently pending activities from the parent job or active subjob. You cannot select the case job activities.
- Optional. To assert on the activity assignment, select Test resource assignment. The currently assigned resources are listed which are non-editable.
-
Click
OK.
Under Steps/Assertions, the added assertion Execute: Activity1 changes as Assert: Activity1 Pending.
-
Click
Save.
On execution, the assertion fails if the activity is not pending or is not assigned to the correct resources depending on the configuration.
Add an event assertion
You can assert on event's count within the parent job or active subjob or case or embedded process.
- In the Add assertion dialog box, on the Assertion type list, select Event.
-
Click
Add event.
The Select an event dialog box is displayed.
-
Click
Add event.
The Select an event dialog box displays the events associated with a process and case under Process and Case tabs.
-
Select the event from the parent job or active sub job and click
OK.
The current event name and the event count are displayed.
Under Steps/Assertions, the added assertion is displayed as Assert: Event Name. Count = "current event count".
-
Click
Save.
On execution, the assertion fails if the event count does not match the configured value.
Add a process and case state assertion
You can assert the current process state's value within the parent job or active subjob, case, or embedded process (which is part of parent job).
-
In the
Add assertion dialog box, on the
Assertion type list, select either option for the
State.
The process state and the case state from the parent job or active subjob or case are displayed. The current job state is displayed which is non-editable.
-
Click
Save.
Under Steps/Assertions, the process state assertion is displayed. On execution of the test case, the assertion fails if the job is not in the correct state.
Add a variable value assertion
You can assert on variable value in the parent job, embedded processes (which are part of the parent job), active subjobs, case variables, and server variables.
- In the Add assertion dialog box, on the Assertion type list, select Variable value.
-
Click
Add variable.
The Select a variable dialog box displays the process and server variables under Process and Server tabs.
-
Select the variable and click
OK.
The selected name and variable are displayed.
-
Click
Save.
The variable name and its value are displayed. On execution, the assertion fails if the variable value is not correct.