Symptoms

After upgrading from v5.4 to v6.0 you see the following error when viewing any test case in specific projects:

Offending URL: __Page
Source: System.Data.Entity
Message: The 'TestCaseWorkflowId' property on 'TestCaseType' could not be set to a 'null' value. You must set this property to a non-null value of type 'Int32'. 
Stack trace: at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal) at lambda_method(Closure , Shaper ) at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) at lambda_method(Closure , Shaper ) at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper) at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at APPLICATION.Business.TestCaseManager.TestCaseType_Retrieve(Int32 projectTemplateId, Boolean activeOnly) at APPLICATION.Web.Administration.ProjectTemplate.TestCaseTypes.LoadTestCaseTypes() at APPLICATION.Web.Administration.ProjectTemplate.TestCaseTypes.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at APPLICATION.Web.PageLayout.OnLoad(EventArgs e) at APPLICATION.Web.Administration.AdministrationBase.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

This can can happen if you have test case types in your v5.4 installation that were not linked to a specific workflow. This in theory should not happen, but if there was a corruption in v5.4 (that would not cause an error unless you tried to use the specific test case type) upon upgrade to 6.0, the error became more serious and blocked use of the test case pages.

You can check if you have this issue by running this SQL query:

SELECT * FROM TST_TEST_CASE_TYPE WHERE TEST_CASE_WORKFLOW_ID IS NULL

If you see any results returned, then you have at least one test case type that is not linked to any workflow

Resolution

To fix the issue, simply run this SQL command to link the test case types with the default workflow in the appropriate project template:

UPDATE TST_TEST_CASE_TYPE
SET TEST_CASE_WORKFLOW_ID = WK.TEST_CASE_WORKFLOW_ID
FROM TST_TEST_CASE_TYPE TT INNER JOIN TST_TEST_CASE_WORKFLOW WK
ON WK.PROJECT_TEMPLATE_ID = TT.PROJECT_TEMPLATE_ID
WHERE TT.TEST_CASE_WORKFLOW_ID IS NULL