I am new to unit testing, but finally getting started.
I have been running into a situation where my unit test names apparently grow too long to readable due to the multiple parameters and combinations of them. For example, consider these hypothetical test case names resembling my actual test case names:
GetAllEmployeeRecords_UserBelongsToHeadQuarterAndDeptIsFinanceAndDesignationIsManager_AccessAllowed GetAllEmployeeRecords_UserBelongsToHeadQuarterAndDeptIsFinanceAndDesignationIsAnalyst_AccessDenied GetAllEmployeeRecords_UserBelongsToHeadQuarterAndDeptIsFinanceAndDesignationIsTemp_AccessDenied GetAllEmployeeRecords_UserBelongsToHeadQuarterAndDeptIsHrAndDesignationIsManager_AccessAllowed GetAllEmployeeRecords_UserBelongsToHeadQuarterAndDeptIsHrAndCorpConselor_AccessDenied GetAllEmployeeRecords_UserBelongsToHeadQuarterAndDeptIsHrAndDesignationIsTemp_AccessDenied GetAllEmployeeRecords_UserDoesNotBelongToHeadQuarter_AccessDenied
I feel that the UserBelongsToHeadQuarter phrase in the names is redundant for the 6 out of 7 test cases but it is also important to distinguish the 6 tests from the 7th test.
Using a [TestCategory] might work but my team members have concerns that failing test case might have difficulty communicating what exact scenario is failing on test execution reports and/or the [TestCategory] is more suitable for breaking down the tests by component or feature.
Is there a better way to organize or name these for more readability?