【发布时间】:2014-02-11 01:01:11
【问题描述】:
我正在使用 Rally excel 插件并尝试检索用户故事和相关的测试用例。我在报告“用户故事”中添加了额外的列来检索 TestCase.Name,还尝试了 TestCase.FormattedID。在这两种情况下,我都会收到空列。我究竟做错了什么? 还有一列“测试用例数”也总是不返回任何内容。
【问题讨论】:
标签: rally excel-addins
我正在使用 Rally excel 插件并尝试检索用户故事和相关的测试用例。我在报告“用户故事”中添加了额外的列来检索 TestCase.Name,还尝试了 TestCase.FormattedID。在这两种情况下,我都会收到空列。我究竟做错了什么? 还有一列“测试用例数”也总是不返回任何内容。
【问题讨论】:
标签: rally excel-addins
这是一个构建用户故事网格和相关测试用例的自定义应用。看起来这是您要显示的数据:
代码在this git hub repo 中提供。您可以将 html 文件复制/粘贴到自定义页面中。
Ext.define('CustomApp', {
extend: 'Rally.app.TimeboxScopedApp',
componentCls: 'app',
scopeType: 'iteration',
comboboxConfig: {
fieldLabel: 'Select an Iteration:',
labelWidth: 100,
width: 300
},
onScopeChange: function() {
Ext.create('Rally.data.WsapiDataStore', {
model: 'UserStory',
fetch: ['FormattedID','Name','TestCases'],
pageSize: 100,
autoLoad: true,
filters: [this.getContext().getTimeboxScope().getQueryFilter()],
listeners: {
load: this._onDataLoaded,
scope: this
}
});
},
_onDataLoaded: function(store, data){
var stories = [];
var pendingTestCases = data.length;
Ext.Array.each(data, function(story) {
var s = {
FormattedID: story.get('FormattedID'),
Name: story.get('Name'),
_ref: story.get("_ref"),
TestCaseCount: story.get('TestCases').Count,
TestCases: []
};
var testcases = story.getCollection('TestCases');
testcases.load({
fetch: ['FormattedID'],
callback: function(records, operation, success){
Ext.Array.each(records, function(testcase){
s.TestCases.push({_ref: testcase.get('_ref'),
FormattedID: testcase.get('FormattedID'),
Name: testcase.get('Name')
});
}, this);
--pendingTestCases;
if (pendingTestCases === 0) {
this._createGrid(stories);
}
},
scope: this
});
stories.push(s);
}, this);
} ,
_createGrid: function(stories) {
var myStore = Ext.create('Rally.data.custom.Store', {
data: stories,
pageSize: 100,
});
if (!this.grid) {
this.grid = this.add({
xtype: 'rallygrid',
itemId: 'mygrid',
store: myStore,
columnCfgs: [
{
text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
},
{
text: 'Name', dataIndex: 'Name'
},
{
text: 'TestCase Count', dataIndex: 'TestCaseCount'
},
{
text: 'Test Cases', dataIndex: 'TestCases', flex:1,
renderer: function(value) {
var html = [];
Ext.Array.each(value, function(testcase){
html.push('<a href="' + Rally.nav.Manager.getDetailUrl(testcase) + '">' + testcase.FormattedID + '</a>' + ' ' + testcase.Name);
});
return html.join(', ');
}
}
]
});
}else{
this.grid.reconfigure(myStore);
}
}
});
如果您更喜欢按版本而不是迭代进行过滤,您可以更改 scopeType of Rally.app.TimeboxScopedApp
Ext.define('CustomApp', {
extend: 'Rally.app.TimeboxScopedApp',
componentCls: 'app',
scopeType: 'release',
comboboxConfig: {
fieldLabel: 'Select a Release:',
labelWidth: 100,
width: 300
},
就 Excel 插件而言,我没有在用户故事查询中看到一个可用的列,该列将显示与故事关联的测试用例。由于 TestCases 是 WS API 中 HierarchicalRequirement 对象的集合,因此必须进行单独的查询以获取各个测试用例。这就是我在上面的代码中所做的。
这是我的 Excel 插件的屏幕截图。有 TestCaseStatus,这是预期的,但不包括 TestCases 集合,因为该集合只会返回一个 uri。也许您正在使用自定义工具从 Rally 导出到 Excel。
【讨论】:
使用TestCases.FormattedID,它会将所有链接的测试用例放在一个以逗号分隔的单元格中。
【讨论】: