2014-02-11 36 views
2

我正在使用拉力賽excel加載項並試圖檢索用戶故事和相關測試用例。我在報告「用戶故事」中添加了額外的列以檢索TestCase.Name並嘗試了TestCase.FormattedID。在這兩種情況下,我都會收到空欄。我究竟做錯了什麼? 此外還有一個「測試用例數量」列也總是不返回任何內容。檢索用戶故事及其相關測試用例

回答

1

這是一個自定義應用程序,它構建用戶故事和相關測試用例的網格。看起來這是你要顯示的數據:

enter image description here

的代碼在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); 
     } 
    } 
}); 

如果希望通過發佈篩選,不迭代,你可以改變的Rally.app.TimeboxScopedApp

Ext.define('CustomApp', { 
    extend: 'Rally.app.TimeboxScopedApp', 
    componentCls: 'app', 
    scopeType: 'release', 
    comboboxConfig: { 
     fieldLabel: 'Select a Release:', 
     labelWidth: 100, 
     width: 300 
    }, 

scopeType至於Excel加載項,我沒有看到一個用戶故事查詢可用列將顯示與故事相關的測試案例。由於TestCases是WS API中HierarchicalRequirement對象上的一個集合,因此需要單獨查詢以獲取單個測試用例。這就是我在上面的代碼中所做的。

這是我的Excel插件的截圖。有TestCaseStatus,這是預期的,但TestCases集合不包括在內,因爲集合只會返回一個uri。也許您正在使用自定義工具從Rally導出到Excel。

enter image description here

+0

感謝您提供此解決方案。問題:如何擺脫「迭代」下拉菜單,因爲我們實際上是按「釋放」條款操作的。 – stella

+0

另外我發現了另一個解決方案:在Rally中創建報告,然後將其導出爲.csv,然後編寫一些excel宏以正確解析它。您是否知道在應用分組之前是否可以實際下載Rally報告爲純原始數據(在UI上顯示爲Pivot報告)? – stella

+0

您可以將scopeType表單迭代更改爲發佈。我更新了該信息的帖子。獲取「原始數據」的方法是直接查詢WS API,但是如果需要獲取集合的元素,則需要兩個單獨的請求 - 一個用於用戶故事,包括測試用例集合,然後是集合本身。 – nickm

0

使用TestCases.FormattedID,它會給所有鏈接的測試用例用逗號隔開的單細胞。