Using com4j and Quality Center to add design steps to test

1.9k views Asked by At

All,

I am using com4j to manipulate Quality Centre and can successfully create test plans and labs, nested folders and actual items in both.

I am now trying to add design steps to a test e.g.:

ITestFactory iTestFactory = sNode.testFactory().queryInterface(ITestFactory.class);
Com4jObject oTest = iTestFactory.addItem(name);
ITest iTest = oTest.queryInterface(ITest.class);
iTest.field("TS_DESCRIPTION", description);
iTest.field("TS_STATUS", "Design");
iTest.field("TS_DEV_COMMENTS", comments);
iTest.post();

This all works fine, I then try to do:

IBaseFactory iFactory = iTest.designStepFactory().queryInterface(IBaseFactory.class);

IStep iStep = iFactory.addItem(1).queryInterface(IStep.class); // ends up null

iStep.field("ST_DESCRIPTION", "Step desc 1");
iStep.field("ST_EXPECTED", "Expected 1");
iStep.post();

But iStep always ends up as null. There is no IDesignStepFactory interface hence I am trying to use the base factory in the queryInterface call.

Checking the QC help files and the otaclient.dll seems to indicate there is no such thing as an IDesignStepFactory interface and in (some) VB examples the base factory is used, hence my attempt above...

This is one of a couple of places where a factory method is available, but no explicit interface seems to be, e.g.:

ITestSet ts; ts.tsTestFactory() // no ITSTestFActory interface exists...

Any pointers gratefully received,

Simon

1

There are 1 answers

0
Alex Shnayder On

As a rule IBaseFactory.addItem should receive the equivalent of DBNull as it's parameter and not anything else, in your posted code it's "1". Unless explicitly specified in documentation of entity in question the set of other values it can accept and their purpose.

In case of design step I'm gessing it should be DBNull.