2015-08-22 42 views
0

问题1:是否可以向故事板中的每张卡添加自定义数据(例如:testcase count:5)?如果是这样,怎么样?我无法在文档中找到示例或特定信息。如何在故事板中添加自定义数据?

问题2:是否可以在一个查询中获得高级故事的测试用例数(包括儿童故事测试用例)?

请让我知道。这里是我的代码

Ext.define('Rally.Story.View', { 
    extend: 'Rally.app.App', 

    launch: function() { 
     this.add({ 
      xtype: 'rallyfieldvaluecombobox', 
      fieldLabel: 'Filter by Target Release:', 
      model: 'UserStory', 
      field: 'c_TargetRelease', 
      value: '15.0', 
      listeners: { 
       select: this._onSelect, 
       ready: this._onLoad, 
       scope: this 
      } 
     }); 
    }, 

    _onLoad: function() { 
     this.add({ 
      xtype: 'rallycardboard', 
      types: ['User Story'], 
      attribute: 'ScheduleState', 
      readOnly: true, 
      fetch: ['Name', 'TestCases', 'c_StoryType', 'c_TargetRelease', 'PlanEstimate', 'Priority', 'TaskEstimateTotal', 'TaskRemainingTotal'], 
      context: this.getContext(), 
      cardConfig: { 
       editable: false, 
       showIconsAndHighlightBorder: false, 
       fields: ['Name', 'c_StoryType', 'c_TargetRelease', 'PlanEstimate', 'c_PriorityBin', 'Parent', 'TestCases', 'TaskEstimateTotal', 'TaskRemainingTotal'] 
      }, 
      storeConfig: { 
       filters: [ 
        { 
         property: 'c_StoryType', 
         value: 'SAGA Feature' 
        }, 
        { 
         property: 'c_TargetRelease', 
         operator: '=', 
         value: this.down('rallyfieldvaluecombobox').getValue() 
        } 
       ] 
      } 
     }); 
    }, 

    _onSelect: function() { 
     var board = this.down('rallycardboard'); 
     board.refresh({ 
      storeConfig: { 
       filters: [ 
        { 
         property: 'c_StoryType', 
         value: 'SAGA Feature' 
        }, 
        { 
         property: 'c_TargetRelease', 
         operator: '=', 
         value: this.down('rallyfieldvaluecombobox').getValue() 
        } 
       ] 
      } 
     }); 
    },   
}); 

回答

1

这是我由包含测试用例计数的样本卡:

Card Screenshot

您可以通过简单地包括在它的一些渲染信息的对象,而不是增加一个字段只是场阵列中的cardConfig在一个简单的字符串:

cardConfig: { 
    fields: [ 
     'Name', //simple string field to show 
     { 
      name: 'TCCount', //field name 
      hasValue: function() {return true;}, //always show this field 
      renderTpl: Ext.create('Rally.ui.renderer.template.LabeledFieldTemplate', { 
         fieldLabel: 'Test Case Count', //the field label 
         valueTemplate: Ext.create('Ext.XTemplate', 
          ['{[this.getTestCaseCount(values)]}', 
          {getTestCaseCount: function(data) { return data.Summary.TestCases.Count;}}]) 
        }) 
     }, 
     //additional string fields 
     'PlanEstimate', 'Parent', 'TestCases', 'TaskEstimateTotal', 'TaskRemainingTotal'] 
} 

该结束了,比我想migh那么简单不过,但至少它是可行的。关键部分是使用LabeledFieldTemplate,指定实际呈现内容的字段标签和值模板。

您还会注意到由于TestCases包含在字段列表中的脚注中会自动显示小烧杯状态图标。

至于你的第二个问题,对于儿童故事中包含的测试用例的总数,故事没有卷起栏。

+0

非常感谢Kyle。这非常有帮助! – Sharma