Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Unique custom field


#1

We’ve added a custom field that we would like to make unique across all test cases. As I’m not sure there’s a soft way to do this, I was going to modify the database table to add a unique index for that field.

Will TestRail fail gracefully when experiencing this restriction on a save? For example, will it go back to a submission screen with all fields filled out and an error showing, or will we lose all the values associated with that submission?


#2

Hello Chris,

Thanks for your posting. A unique constraint for custom fields is not supported by TestRail as a built-in feature currently. Please do not make manual changes to TestRail’s database schema, as this can cause problems with future database upgrades and we cannot support such changes.

When TestRail sees a database error (including validation errors for unique keys) it displays a separate error page (and the user can no longer change the submission form).

One possible workaround for your question would be to add a UI script that soft-checks the unique constraint via a server-side script when the user clicks the Add/Update button and displays a meaningful error message in case the unique constraint would be violated (and otherwise submits the form as usual). This is not guaranteed to be unique (as two requests with the same value could be made simultaneously in theory), but would this work for you? If so, I’m happy to explain the details.

Regards,
Tobias