【问题标题】:Retrieve User Stories and associated Test Cases with it检索用户故事和相关的测试用例
【发布时间】:2014-02-11 01:01:11
【问题描述】:

我正在使用 Rally excel 插件并尝试检索用户故事和相关的测试用例。我在报告“用户故事”中添加了额外的列来检索 TestCase.Name,还尝试了 TestCase.FormattedID。在这两种情况下,我都会收到空列。我究竟做错了什么? 还有一列“测试用例数”也总是不返回任何内容。

【问题讨论】:

    标签: rally excel-addins


    【解决方案1】:

    这是一个构建用户故事网格和相关测试用例的自定义应用。看起来这是您要显示的数据:

    代码在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。

    【讨论】:

    • 感谢您提供此解决方案。问题:如何摆脱“迭代”下拉菜单,因为我们实际上是按照“发布”条款操作的。
    • 我还找到了我的问题的另一个解决方案:在 Rally 中创建报告,然后将其导出为 .csv,然后编写一些 excel 宏来正确解析它。您知道是否可以在对 Rally 报告应用分组之前将其作为纯原始数据下载(在 UI 上显示为 Pivot 报告)?
    • 您可以将 scopeType 表单迭代更改为发布。我用该信息更新了帖子。获取“原始数据”的方法是直接查询 WS API,但如果您需要获取集合的元素,则需要两个单独的请求 - 一个针对用户故事,包括测试用例集合,然后针对集合本身。
    【解决方案2】:

    使用TestCases.FormattedID,它会将所有链接的测试用例放在一个以逗号分隔的单元格中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-27
      • 1970-01-01
      • 2021-01-29
      • 2021-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多