如何通过 OTA API 从 Quality Center 中的测试中删除步骤
在 Quality Center OTA API 中,如何删除测试中的步骤。当我使用 DesignStepFactory 的 RemoveItem 方法删除步骤时,它们仍然保留 - 我尝试通过 ID 和步骤引用删除:
Test test = _qcAccess.AddTest(folderId);
test.Name = "Test 1";
test.Post();
DesignStepFactory factory = (DesignStepFactory) test.DesignStepFactory;
DesignStep step = (DesignStep)factory.AddItem(1);
step.StepName = "Step1";
step.Post();
Test test2 = _qcAccess.FindExistingTest((int)test.ID);
DesignStepFactory factory2 = (DesignStepFactory) test2.DesignStepFactory;
Assert.Equal(1, test2.DesStepsNum);
factory2.RemoveItem(factory2[0]);
test2.Post();
Test test3= _qcAccess.FindExistingTest((int)test.ID);
Assert.Equal(0, test3.DesStepsNum); // test fails here, DesStepsNumb is still 1
根据 OTA API 文档
删除项目方法
描述:从列表中删除项目 数据库。发生移除 立即,无需邮寄。
语法:
公共子RemoveItem(ByVal ItemKey作为变体)
项目键:
Step.ID(长),对 步骤对象或变体数组 步骤.ID.步骤.ID。
所以看起来它应该有效。仅供参考,这是 QC10 的。
有什么想法吗?
In the Quality Center OTA API how can you delete steps from a test. When I delete steps using the RemoveItem method of the DesignStepFactory, they still remain - I've tried deleting by both ID and step reference:
Test test = _qcAccess.AddTest(folderId);
test.Name = "Test 1";
test.Post();
DesignStepFactory factory = (DesignStepFactory) test.DesignStepFactory;
DesignStep step = (DesignStep)factory.AddItem(1);
step.StepName = "Step1";
step.Post();
Test test2 = _qcAccess.FindExistingTest((int)test.ID);
DesignStepFactory factory2 = (DesignStepFactory) test2.DesignStepFactory;
Assert.Equal(1, test2.DesStepsNum);
factory2.RemoveItem(factory2[0]);
test2.Post();
Test test3= _qcAccess.FindExistingTest((int)test.ID);
Assert.Equal(0, test3.DesStepsNum); // test fails here, DesStepsNumb is still 1
According to the OTA API documentation
RemoveItem Method
Description: Removes item from the
database. Removal takes place
immediately, without a Post.Syntax:
Public Sub RemoveItem(ByVal ItemKey As Variant)
ItemKey:
The Step.ID (long), a reference to the
Step Object or a Variant array of
Step.IDs.Step.IDs.
So it looks like it should work. FYI this is for QC10.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
修复方法是使用 List("") 检索步骤列表,使用工厂上的索引访问器会返回无效的步骤实例,其中 ID 只是元素的索引,并且所有属性均为 null。
The fix is to use List("") to retrieve the list of steps, it appears using the indexed accessor on the factory returns invalid step instances, where the ID is just the index of the element, and all properties are null.