检索用户案例和相关的测试用例 [英] Retrieve User Stories and associated Test Cases with it

查看:97
本文介绍了检索用户案例和相关的测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Rally excel加载项,并尝试检索用户案例和相关的测试用例.我在报告用户故事"中添加了其他列,以检索TestCase.Name,还尝试了TestCase.FormattedID.在这两种情况下,我都会收到空列.我究竟做错了什么? 此外,还有测试用例数量"列,该列也始终不返回任何内容.

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.

推荐答案

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

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:

该代码可在此git hub存储库中获得.您可以将html文件复制/粘贴到自定义页面中.

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);
         }
    }
});

如果您希望按发布而不是迭代进行过滤,则可以更改Rally.app.TimeboxScopedAppscopeType

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
    },

就Excel加载项而言,我没有看到用户故事"查询中的可用列,该列将显示与故事相关的测试用例.由于TestCases是 WS API 中HierarchicalRequirement对象的集合,进行个别测试用例.这就是我在上面的代码中所做的.

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.

这是我的Excel插件的屏幕截图.有TestCaseStatus,这是预期的,但不包含TestCases集合,因为该集合将仅返回uri.也许您正在使用自定义工具从Rally导出到Excel.

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.

这篇关于检索用户案例和相关的测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆