Forum Discussion

ANW's avatar
ANW
Contributor
14 years ago

Possibility to copy field values from TestCase to linked Defect?

I have gotten a requirement from management, that I need to be able to document which team/developers who have most tests fail.



Now I thought that the best way of doing this would be to create a new field on both my Test Case and Defect forms with a list of current Developers.



Now obviously I would use this on the Test Case when it is created for one of the Developer's stories. Then if it fails in test, a Defect is automatically created.



But I want some of the values from fields on the Test Case to show up on the Defect by default, like which Developer was responsible, so I don't have to set that up manually once the Defect is created.



Is there any way for me to set up the system, so the Developer field on the Defect form, shows the value selected on the Developer field on the Test Case form, when the Defect is created because the Test Case failed (thus they are linked)??
  • ANW's avatar
    ANW
    Contributor
    I figured it out myself :)



    It seems that if you have a field on the TestCase that also exists on the Defect (same type and name), then any Defect created from a TestCase will have whatever value the testCase had, in that field.



    F.x. on my TestCase I have a Choice Field called 'Developer', and I have the same on the Defect. If a TestCase fails and I let it auto-generate a Defect, then 'Developer' on the Defect contains the same value as it does on the Test Case.



    Hidden feature?? ;) ... at least I could find no documentation on this.
  • Well, that's news to me, Anders! Guess I have some testing to do. I know this has come up and we have it on our enhancement to-do list, so maybe there's something out there I'm not aware of.

    Interesting!
  • Yep, seems to work just fine for Custom Fields.

    All you need to do is define Custom Fields on Test Cases and Custom Fields on Defects that match exactly: use the same custom field number, name, and type and when you fail the test case the custom fields are mapped to the Defect.

    Cool. 

    Guess I need to talk to the documentation team :)
  • ANW's avatar
    ANW
    Contributor
    Actually, the custom field numbers do not have to match :)



    On my TestCase form, 'Developer' is field 14, and on Defect it is 12.