2013-11-15 2 views
1

200 개가 넘는 테스트 케이스가있는 테스트 세트가 있습니다. 아래 코드를 사용하여 모든 테스트 케이스를 가져 오려고합니다. 그러나 어떤 구성도 작동하지 않습니다.테스트 세트의 모든 테스트 케이스 가져 오기 모든 테스트 케이스를 반환 할 수 없음 v2.0

testSet.getCollection('TestCases').load({ 
    limit: Infinity, 
    scope:this, 
    callback: function(testCases, operation, success) { 


    } 
}); 

답변

1

또한 getCollection 메소드에 설정을 전달할 수도 있습니다. 로드에 직접 전달하는 버그가 있다고 생각합니다. 이런 일을 행운을 빌어 요.

testSet.getCollection('TestCases', { 
    limit: Infinity, 
    autoLoad: true 
    listeners: { 
     load: function(store, records) { 
      //process testcases 
     }, 
     scope: this 
    } 
}); 
1

다음은 관련된 테스트 케이스가있는 테스트 세트의 그리드를 만드는 코드 예제입니다. 테스트 세트는 다음에 의해 필터링됩니다.

Ext.define('CustomApp', { 
    extend: 'Rally.app.TimeboxScopedApp', 
    componentCls: 'app', 
    scopeType: 'release', 

    addContent: function() { 
     this._makeStore(); 
    }, 

    onScopeChange: function() { 
     this._makeStore(); 
    }, 

    _makeStore: function(){ 
     Ext.create('Rally.data.WsapiDataStore', { 
       model: 'TestSet', 
       fetch: ['FormattedID', 'TestCases', 'TestCaseStatus'], 
       pageSize: 100, 
       autoLoad: true, 
       filters: [this.getContext().getTimeboxScope().getQueryFilter()], 
       listeners: { 
        load: this._onTestSetsLoaded, 
        scope: this 
       } 
      }); 
    }, 
    _onTestSetsLoaded: function(store, data){ 
     var testSets = []; 
     var pendingTestCases = data.length; 
     console.log(data.length); 
     if (data.length ===0) { 
      this._createTestSetGrid(testSets); 
     } 
     Ext.Array.each(data, function(testset){ 
      var ts = { 
       FormattedID: testset.get('FormattedID'), 
       _ref: testset.get('_ref'), //required to make FormattedID clickable 
       TestCaseStatus: testset.get('TestCaseStatus'), 
       TestCaseCount: testset.get('TestCases').Count, 
       TestCases: [] 
      }; 
      var testCases = testset.getCollection('TestCases'); 
      testCases.load({ 
           fetch: ['FormattedID'], 
           callback: function(records, operation, success){ 
            Ext.Array.each(records, function(testcase){ 
             ts.TestCases.push({_ref: testcase.get('_ref'), 
                 FormattedID: testcase.get('FormattedID') 
                }); 
            }, this); 
            --pendingTestCases; 
            if (pendingTestCases === 0) { 
             this._createTestSetGrid(testSets); 
            } 
           }, 
           scope: this 
          }); 
      testSets.push(ts); 
    },this); 
}, 

     _createTestSetGrid: function(testsets) { 
     var testSetStore = Ext.create('Rally.data.custom.Store', { 
       data: testsets, 
       pageSize: 100, 
      }); 
     if (!this.down('#testsetgrid')) { 
     this.grid = this.add({ 
      xtype: 'rallygrid', 
      itemId: 'testsetgrid', 
      store: testSetStore, 
      columnCfgs: [ 
       { 
        text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn', 
        tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate') 
       }, 
       { 
        text: 'Test Case Count', dataIndex: 'TestCaseCount', 
       }, 
       { 
        text: 'Test Case Status', dataIndex: 'TestCaseStatus',flex:1 
       }, 
       { 
        text: 'TestCases', 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>') 
         }); 
         return html.join(', '); 
        } 
       } 
      ] 
     }); 
     }else{ 
      this.grid.reconfigure(testSetStore); 
     } 
    } 
});