If you are trying to run a test case or test set and you receive the following error:

Messages:
   Database constraint violation occurred [APPLICATION.Business.EntityConstraintViolationException]
   An error occurred while updating the entries. See the inner exception for details. [System.Data.UpdateException]
   Violation of PRIMARY KEY constraint 'XPKTST_ARTIFACT_CUSTOM_PROPERTY'. Cannot insert duplicate key in object 'dbo.TST_ARTIFACT_CUSTOM_PROPERTY'.
The statement has been terminated. [System.Data.SqlClient.SqlException]

Then this article provides the solution for you.

Cause of the Problem

The problem occurs because the custom property table (TST_ARTIFACT_CUSTOM_PROPERTY) has entries for test runs that no longer exist in the system. This can happen if you delete test runs from the database and the entries get left in this table.

Resolution

The solution is to run this SQL query that removes them:

DELETE FROM TST_ARTIFACT_CUSTOM_PROPERTY
WHERE ARTIFACT_TYPE_ID = 5
AND ARTIFACT_ID NOT IN (SELECT TEST_RUN_ID FROM TST_TEST_RUN)

 

Article Info
  • Last Updated: 1/25/2018
  • Article ID: KB319
  • Views: 778