The Start Rule Tests (Applications) Smart Service executes the test cases configured for all expression rules in the specified Appian application(s). To test all expression rules within Appian, see Start Rule Tests (All).
For additional context on how this smart service can be used to perform automated testing, see Automated Testing for Expression Rules.
Activating this smart service in the process model starts an asynchronous test run in Appian, and immediately returns a test-run ID that can be used with the a!testRunResultForId() function to retrieve the results when the test run is finished. To check on the status of a test run, use the test-run ID with the a!testRunStatusForId() function.
The screenshot below shows a simple workflow that starts a test run, then checks on the status of the test run until the test is completed. The Get Test Status script task, which calls the a!testRunStatusForId() function, starts on a scheduled delay of 1 minute. If the status of the test is not COMPLETE
, the process model loops back to the Get Test Status script task, until the status is COMPLETE
. At this point, the results of the test are retrieved by the Get Test Results script task, by calling the a!testRunResultForId() function.
To learn more about parsing test results, see Parsing Batch Test Results for Expression Rules.
Note: The Start Rule Tests (Applications) smart service only executes the tests in the applications and expression rules to which the user has at least viewer rights. See Permissions Needed section for additional details.
This smart service can also be executed from web APIs and interfaces. See a!startRuleTestsApplications().
The test run initiated by this smart service only executes the tests in the applications and expression rules to which the user has at least viewer rights.
When initiating this smart service from a process model, you can adjust the user context used to run the smart service from the Assignment tab. See Assignments for more information.
When calling the a!startRuleTestsApplications() function from a web API, you can specify different credentials to be used by this function; see Web APIs for more information.
Getting test status or test results via a!testRunStatusForId() or a!testRunResultForId() can only be performed by the user who initiated the test. In addition, users of type administrator can fetch test results for all users.
This section contains tab configuration details specific to this smart service. For more information about common configurations see the Process Node Properties page.
Name | Data Type | Description | Required | Multiple |
---|---|---|---|---|
applications | Application | The applications containing expression rules, whose test cases will be executed. | Yes | Yes |
See also: Application
The following configurations and expected behavior apply when using this smart service from Process Modeler, expression rules, interfaces, or web APIs:
To set the applications on which expression rule tests should be executed, complete the following:
Name | Data Type | Description |
---|---|---|
Test-run ID | Number (Integer) | This unique id can be used by the a!testRunStatusForId and the a!testRunResultForId functions. |
See also: Number (Integer)
Executes the test cases configured for all expression rules in the specified Appian application(s) from web APIs and interfaces.
a!startRuleTestsApplications( applications, onSuccess, onError )
Keyword | Type | Description |
---|---|---|
|
Application or Application Array |
The applications containing expression rules, whose test cases will be executed. |
|
Any Type |
A list of saves or an HTTP response to execute after the smart service executes successfully. Created with |
|
Any Type |
A list of saves or an HTTP response to execute when the smart service does not execute successfully. Created with |
startTestsAll
smart service was called.Create two constants of type Application, and set them to two different applications in your environment
For example:
cons!PURCHASE_REQUEST_APPLICATION
- A constant for a Purchase Request application
cons!CRM_APPLICATION
- A constant for a CRM application
Both examples below return an integer representing the test-run ID. For example: 1,2, 3, etc.
Copy and paste any of these examples into a new writeable web API to see how this works.
Starting test for one application.
1
2
3
4
5
6
7
8
9
10
11
a!startRuleTestsApplications(
applications: cons!PURCHASE_REQUEST_APPLICATION,
onSuccess: a!httpResponse(
statusCode: 200,
body: fv!testRunId
),
onError: a!httpResponse(
statusCode: 500,
body: "Error calling a!startRuleTestsApplications"
)
)
Starting test for multiple applications.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
a!startRuleTestsApplications(
applications: {
cons!PURCHASE_REQUEST_APPLICATION,
cons!CRM_APPLICATION
},
onSuccess: a!httpResponse(
statusCode: 200,
body: fv!testRunId
),
onError: a!httpResponse(
statusCode: 500,
body: "Error calling a!startRuleTestsApplications"
)
)
Feature | Compatibility | Note |
---|---|---|
Portals | Partially compatible | Can be used with Appian Portals if it is connected using an integration and web API. |
Offline Mobile | Incompatible | |
Sync-Time Custom Record Fields | Incompatible | |
Real-Time Custom Record Fields | Incompatible | Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. |
Process Reports | Incompatible | Cannot be used to configure a process report. |
Process Events | Incompatible | Cannot be used to configure a process event node, such as a start event or timer event. |
Start Rule Tests (Applications)