1

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 メソッド

説明: データベースからアイテムを削除します。削除は、ポストなしですぐに行われます。

構文:

Public Sub RemoveItem(ByVal ItemKey As Variant)

アイテムキー:

Step.ID (long)、Step オブジェクトへの参照、または Step.IDs.Step.ID の Variant 配列。

それで、それはうまくいくように見えます。ちなみにこれはQC10用です。

何かご意見は?

4

1 に答える 1

0

修正は、List( "")を使用してステップのリストを取得することです。ファクトリでインデックス付きアクセサを使用すると、無効なステップインスタンスが返されます。ここで、IDは要素のインデックスであり、すべてのプロパティはnullです。

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.Post();

Test test2 = _qcAccess.FindExistingTest((int)test.ID);
DesignStepFactory factory2 = (DesignStepFactory)test2.DesignStepFactory;
Assert.Equal(1, test2.DesStepsNum);

var list = factory2.NewList(""); // get a list
factory2.RemoveItem(list[1]); // note: list indexing starts at 1 (ugh!)
test2.Post();

Test test3 = _qcAccess.FindExistingTest((int)test.ID);
Assert.Equal(0, test3.DesStepsNum);
于 2010-10-07T18:50:35.200 に答える