Obtenez tous les cas de test avec un testset ne peut pas renvoyer tous les cas de test V2.0

StackOverflow https://stackoverflow.com//questions/20004160

  •  20-12-2019
  •  | 
  •  

Question

J'ai un ensemble de test contenant plus de 200 cas de test.J'essaie d'aller chercher tous les cas de test en utilisant le code ci-dessous.Cependant aucune de la configuration ne fonctionne

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


    }
});

Était-ce utile?

La solution

Vous pouvez également essayer de transmettre votre configuration à la méthode GetCollection à la place.Je pense qu'il y a quelques bugs qui les transmettent directement dans la charge.J'ai eu de la chance de faire quelque chose comme ceci:

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

Autres conseils

Voici un exemple de code qui crée une grille d'ensembles de test avec des cas de test associés.Les tests de test sont filtrés par version:

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top