【问题标题】:Rally SDK collection store sync throwing 404Rally SDK 集合存储同步抛出 404
【发布时间】:2017-01-31 17:42:41
【问题描述】:

编辑:我最终使用 Rally.data.util.Record.serverSideCopy() 并重新检索/更新新的测试用例来完成这项工作。我没有解决这个问题,因为我仍然无法弄清楚我为什么要让 404 同步(不过,我可能没有时间深入研究它,因为我走的是不同的方向)。

我正在尝试将 TestCaseSteps 添加到 TestCase(我从另一个 TestCase 复制的 - 原始步骤集合在保存过程中丢失,因为它们与原始 TestCase 相关联)。我尝试遵循 Collection Modification section of the doc 中建议的添加/同步模式,但仅提供 Steps 的 _ref 值会导致 sync() 操作失败并在 POST 上出现 404:

HTTP ERROR 404

Problem accessing /slm/webservice/v2.0/TestCase/90167266916/Steps/add. Reason:

Not Found

如下所示,然后我尝试通过原始对象而不是 _ref 值添加步骤,但我收到了相同的 404。

我在这里做错了什么?为什么我的同步操作会导致 404?

为了进一步了解,这里是回购: https://github.com/crdschurch/reuse-rally-test

var newSteps = newTestCase.getCollection('Steps', {autoLoad: true});

  oldTestCase.getCollection('Steps').load({
    callback: function(oldRecords, newOperation, newSuccess) {
      Ext.Array.each(oldRecords, function(step) {
        console.log(step.get('_ref'));
        //debugger;
        newSteps.add(
          {
            'Input': step.get('Input'),
            'ExpectedResult': step.get('ExpectedResult'),
            'StepIndex': step.get('StepIndex'),
            'TestCase': newTestCase.get('ObjectID')
          }
        );
      });

      console.log('Syncing: ');
      console.log(newSteps);

      newSteps.sync({
        callback: function() {
          console.log('New Test: ');
          console.log(newTestCase);
        }
      });
    }
  });

【问题讨论】:

    标签: javascript post sdk rally


    【解决方案1】:

    我的猜测是您需要将 TestCase 指定为 ref 而不仅仅是它的 objectid:

    newSteps.add({
        'Input': step.get('Input'),
        'ExpectedResult': step.get('ExpectedResult'),
        'StepIndex': step.get('StepIndex'),
        'TestCase': newTestCase.get('_ref')
    });
    

    【讨论】:

    • 我最终以不同的方式解决了这个问题,但我确实回去尝试了你的建议,在添加步骤时使用测试用例参考。我仍然在同步呼叫中收到 404,并且添加的步骤不在新测试中。为了解决这个问题,我回到文档并找到了 Rally.data.util.Record.serverSideCopy()。这增加了对我的流程的调用(原始测试用例在 Rally 中复制,然后我必须检索它并再次进行更新/保存),但它会在服务器端副本上获取测试用例步骤集合。代码在这里:github.com/crdschurch/reuse-rally-test
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多