我有一系列测试用例,我正试图使用拉力赛 api 添加到拉力赛中的测试集。
我遍历数组并为数组中的每个测试用例调用此方法。它们都被添加到同一个测试集中。
RallyConnect.prototype.addTestCaseToSet = function (tcObjectID, tcRef, tsObjectID, tsRef) {
return new Promise((resolve, reject) => {
// check to make sure it doesn't already exist
rallyApi.query({
ref: '/testset/' + tsObjectID + '/testcases',
fetch: "true",
query: queryUtils.where('ObjectID', '=', tcObjectID)
}, function (error, result) {
if (error) {
reject(error);
} else {
if (result.TotalResultCount > 0) {
resolve({ tsRef: tsRef, tcRef: tcRef, action: 'exists' });
} else {
rallyApi.add({
ref: tsRef,
collection: 'TestCases',
data: [{ _ref: refUtils.getRelative(tcRef) }]
}, function (error, result) {
if (error) {
reject(error);
} else {
resolve({ tsRef: tsRef, tcRef: tcRef, action:
'added' });
}
});
}
}
});
//});
});
}
我收到以下错误很多并且该过程失败
Error: Could not add artifact to collection
at generateError (C:\src\testing_utility\node_modules\rally\dist\request.js:38:11)
at Request._callback (C:\src\testing_utility\node_modules\rally\dist\request.js:118:22)
at Request.self.callback (C:\src\testing_utility\node_modules\rally\node_modules\request\request.js:187:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (C:\src\testing_utility\node_modules\rally\node_modules\request\request.js:1044:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at Gunzip.<anonymous> (C:\src\testing_utility\node_modules\rally\node_modules\request\request.js:965:12)
at emitNone (events.js:110:20)
errors:
[ 'Could not add artifact to collection',
'Concurrency conflict: [Object has been modified since being read for update in this context] - ConcurrencyConflictException : Modified since read on update
: Object Class : com.f4tech.slm.domain.TestSet : ObjectID : 203533554680' ] }
有没有其他人遇到过这个问题,并且知道我能做些什么来确保我不会得到它。