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.
This smart service can also be executed from web APIs and SAIL 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.
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.
|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:
|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 SAIL interfaces.
a!startRuleTestsApplications( applications, onSuccess, onError)
a!httpResponse(). The test-run ID of the executed test run is available in the function variable
fv!testRunId. This can be used to query information about the test run with a!testRunStatusForId() and a!testRunResultForId().
startTestsAllsmart service was called.
Create two constants of type Application, and set them to two different applications in your environment
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.
Starting test for multiple applications.