This project has moved and is read-only. For the latest updates, please go here.

Unable to create a custom report with a query that has linked work items

Feb 13, 2013 at 4:24 PM
I need help in creating a layout which can populate work items with direct links or tree view.

For eg:
Let's say I have a query with all Open requirements and which are linked to Test cases. So the query would be like this in TFS

"And/Or" "Field" "Operator" "Value"
. Team Project = @Project
And Work Item Type = Requirement
And State <> Closed

- Sub-Query with linked items
And linked work items that match the query below:
And Work Item Type = Test Case

For that, I want to build a layout as below which I was not able to do using "Word4tfs" addin

Req ID: ID
Req Title: Title
Req Description: Description
[Linked Items]
Link type: Testcase
TC ID: TestCase ID
TC Title: TestCase Title
TC Execution Status: Status (Passed or Failed)
TC Steps: Actions (Nothing but test case steps)
TC Expected Results: Expected results (Testcase results)
TC Actual Results: Actual results (TestCase results)
Link type: Defects
Defect ID: ID
Defect Title: Title
Defect Description: Synopsis
Defect Reproduce steps: Repro Steps
  • First of all, I did not find any Test cases fields under Edit layout.
  • Only data from direct query is displayed. Let's say, I have a query with linked items and out of which the first query populates the data correctly in their respective fields as defined but linked item is showing some random details which was not liked to that particular requirement.
Please help me in this as I need to develop this report by Monday for client submission.

Thanks,
Sri
Feb 13, 2013 at 9:58 PM
I am slightly confused by the fact that your layout seems to include defects when the query only has linked test cases. I will assume for now that you just want requirements with linked test cases underneath and that you have a tree query which does this.

You need a layout which defines a building block for the work item type which contains the requirements and which defines a building block for the test case work item type. When the query is executed the addin just goes linearly down the list of work items and inserts a building block, choosing the building block that corresponds to the work item type.

If you look at the out of the box layouts in the Layout Designer and take a look at the "Requirements Specification" layouts that will give you an idea of what I am trying to describe. The building block for a specific work item type is marked by a line formatted using the "TFS Work Item Definition" style and contains the name of the work item type. If you add "_N" to the end then the building block will only apply to the Nth level in the tree query (where 0 is the highest level).

Try the Requirement Specification layout on your query, assuming your requirements are User Story work items and your Test Cases are linked to the user stories you should get some sensible output.

I hope this helps. It is quite difficult to explain briefly, if you have further questions please do not hesitate to ask.

Regards

Rob
Feb 14, 2013 at 10:32 PM
Hi Rob,

Thanks for your valuable information. I am now able to pull linked items that are associated with requirement. But the problem I have is, it is creating separate building block for each linked item whereas I expected that it would generate one block for Requirement and linked items within that block as sub-section. The "Requirements Specification" layout which you have said generates test case as sub-item but it doesn't populate all the information I wanted to see.

How can I develop a custom report same as what "Requirements Specification" layout is doing but in presentable way to client.

For eg:
My custom report layout is as below
[
TFS ID: ID
TITLE - CLICK HERE TO ENTER TEXT.
  • Area Path: Area Path
  • Requirement Type: Requirement Type
  • Priority: Priority
  • Work Item Type: Work Item Type
  • Description:
      Description
  • STEPS:
       Steps
    
    CREATED ON CLICK HERE TO ENTER A DATE. BY CLICK HERE TO ENTER TEXT.
    ]
The report was generate as follows:
[
TFS ID: 1234
TITLE - Test Requirement
Area Path: TFS\Requirements
Requirement Type: Functional
Priority: 1
Work Item Type: Requirement
Description:
Description
STEPS:
 Steps

CREATED ON CLICK HERE TO ENTER A DATE. BY CLICK HERE TO ENTER TEXT.
]
[
TFS ID: 1212
TITLE - Test Case for TFS4WORD addin
Area Path: TFS\Requirements
Requirement Type: Requirement Type
Priority: 1
Work Item Type: Test Case
Description:
  Description
STEPS:
        1.          Step1 validating test action. Test action passed
        2.          Step2 Add testcase to word. Testcase added.

CREATED ON CLICK HERE TO ENTER A DATE. BY CLICK HERE TO ENTER TEXT.
]

But the way I wanted to customize is as follows
[
TFS ID: 1234
TITLE - Test Requirement
Area Path: TFS\Requirements
Requirement Type: Functional
Priority: 1
Work Item Type: Requirement
Description:
Description
  • Linked Items:
    Test Case 1212 - Test Case for TFS4WORD addin
    Status: Failed Priority: 2
    Error Message: Separate blocks are generated for each work item.
    Description:
    Description
    STEPS:
        1.          Step1 validating test action. Test action passed
        2.          Step2 Add testcase to word. Testcase added.
    CREATED ON CLICK HERE TO ENTER A DATE. BY CLICK HERE TO ENTER TEXT.
    ]
Feb 15, 2013 at 10:18 AM
I am not entirely sure I understand all the problems you see with the output you are getting, so let me try to address the ones I think you are talking about.

First of all though let me explain, it is by design that you get one building block per work item, there is no concept of a building block containing a work item and any linked items all in the same building block.

One of the things you seem to want is to bold the labels like "Area Path", to do this just edit the layout in the Layout Designer and format the label as you want it to be.
If you want the linked test cases to be indented then change the formatting in the Layout Designer, pick the Test Case building block and indent it.

The one thing you can't do is follow the linked test case building blocks with more information from the parent requirement, as I said that is the way it is currently designed.

If I have missed any important aspects of the desired output that you need then let me know.

Regards

Rob