Testing custom artifacts
You can validate the values of custom artifact types when they are created.
The following example shows how to do this with rules and scripts. For this example, the Object Type is Artifact, the custom artifact type is Corporate User, and the script name is Corporate User ID.
- Create a script that validates the value of an artifact value.
import re if not artifact.value.startswith('cu'): helper.fail("The artifact value for a Corporate User [" + artifact.value + "] must start with CU")
- Create a rule that executes when the custom artifact type is created.
- As a user, create an instance of a custom artifact type that does not meet this rule and verify that you see the message configured in the script.