#112 OTA removeItem not working as expected

Jacob COM (35)

The removeItem call to the OTA library doesnt remove the QC generated first step and forces to use it. version 1.17-M2 running on XP. see description below where bug call is identified.


Variant paramVal = new Variant();

Dispatch runFactory = Dispatch.get(almConnection, "RunFactory").toDispatch();
Dispatch treeMgr = Dispatch.get(almConnection, "TreeManager").toDispatch();
Dispatch testFolder = Dispatch.call(treeMgr, "NodeByPath", ProjectPath).toDispatch();
Dispatch testFactory = Dispatch.get(testFolder, "TestFactory").toDispatch();
Dispatch testSetFactory = Dispatch.get(almConnection, "TestSetFactory").toDispatch();
Dispatch testItem = Dispatch.call (testFactory,"Item",QCTestId).toDispatch();

Dispatch currentRun = Dispatch.call (runFactory,"Item",QCRunId).toDispatch();
Dispatch stepFactory = Dispatch.get(currentRun, "StepFactory").toDispatch();
Dispatch listOfSteps = Dispatch.call(stepFactory, "NewList", "").toDispatch();
Dispatch fieldsList = Dispatch.get(stepFactory, "Fields").toDispatch();

int stepCount = Dispatch.get(listOfSteps, "Count").changeType(Variant.VariantInt).getInt();
int fieldCount = Dispatch.get(fieldsList, "Count").changeType(Variant.VariantInt).getInt();

String stepName = getQCStepValue (QCTestId, "StepName");
String description = getQCStepValue (QCTestId, "StepDescription");
String stepExpectedResult = getQCStepValue (QCTestId, "StepExpectedResult");

for (int i = 1; i<= fieldCount; i++) {
Dispatch object = Dispatch.call(listOfSteps, "Fields", i).toDispatch();
String fieldEquals = Dispatch.get(object, "Name").toString();

Dispatch stepItem=null;

// There is a bug in the jacob library which prevents the Initial step creation by QC.
// To be removed. The Variant wont cast.
// I therefore populate it otherwise create a new step item to populate
// This hackaround should be revisited to append when this is fixed. Only valid
// Since in this case QC tests only ever have one test step.

if (stepCount != 1) {
stepItem = Dispatch.call(stepFactory, "AddItem", paramVal).getDispatch();
} else {
stepItem = Dispatch.call(listOfSteps, "Item", stepCount).toDispatch();

for (int i = 1; i<= stepCount; i++) {
// remove any crap from previous runs
Dispatch Item = Dispatch.call (stepFactory, "Item", i).toDispatch();
Variant p = new Variant();
// Dispatch.call(stepFactory, "RemoveItem", p).toDispatch(); <<<--------- bug here


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks