I am using Rally excel add-in and trying to retrieve User Stories and associated Test Cases. I added additional column to the report "User Story" to retrieve TestCase.Name and also tried TestCase.FormattedID. In both cases I receive empty column. What am I doing wrong? Also there is a column "Number of Test Cases" that also always returns nothing.
问题:
回答1:
Here is a custom app that builds a grid of user stories and associated test cases. Looks like this is the data you want to display:
The code is available in this git hub repo. You may copy/paste the html file into a custom page.
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);
}
}
});
If you prefer to filter by Releases, not Iterations, you may change 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
},
As far as Excel addin, I do not see a column available on a User Story query that would display test cases associated with a story. Since TestCases is a collection on HierarchicalRequirement object in WS API a separate query has to be made to get to individual Test Cases. That's what I did in the code above.
Here is a screenshot from my Excel plugin. There is TestCaseStatus, which is expected, but TestCases collection is not included since the collection will only return a uri. Perhaps you are using a custom tool to export from Rally to Excel.
回答2:
Use TestCases.FormattedID, it will give all linked test cases in single cell separated by comma.