Pregunta

I am trying to link my application with QC and create dynamic test sets through that. I am able to retrieve some QC data using OTAClient.dll. Used com4j to convert into java interfaces. Now i have a requirement of creating a NEW TEST SET in the QC test lab[Will try for existing tests first].

ITDConnection QCConnection = ClassFactory.createTDConnection();
    QCConnection.initConnection("http://server/qcbin", "division", "");
    System.out.println("Is connected: "+QCConnection.connected());
    QCConnection.connectProject("domain", "username", "password");
    System.out.println("Database entered: "+QCConnection.dbName());
    QCConnection.bugFactory().queryInterface(ITestFactory.class);
    ITestSetFactory sTestSetFactory = (QCConnection.testSetFactory()).queryInterface(ITestSetFactory.class);
    ITestSet sTestSet = (sTestSetFactory.item(14002)).queryInterface(ITestSet.class);
    System.out.println("Test details by id: "+sTestSet.checkTestInstances("testid"));

The above code is used to get the test details. Can anyone help in creation of test set? Thanks

¿Fue útil?

Solución 2

Well thanks Plobpo. For now we used the index for root and then created a test folder. Here is the code with some additional improvements: Also includes adding release target which was one of the error we faced in the process.

ITDConnection QCConnection = ClassFactory.createTDConnection();
QCConnection.initConnection("http://nceqcwebp1/qcbin", "E_TRAVEL", "");
QCConnection.connectProject("ETVNRE", "vigupta", "Amadeus!!");
ITestSetTreeManager treeManager = QCConnection.testSetTreeManager().queryInterface(ITestSetTreeManager.class);
ITestSetFolder baseFolder = treeManager.root().queryInterface(ITestSetFolder.class);
baseFolder.addNode("Automatic Test Creation");
ITestSetFolder testSetFolder = treeManager.nodeById(baseFolder.findChildNode("Automatic Test Creation").nodeID()).queryInterface(ITestSetFolder.class);

ITestSetFactory factory = testSetFolder.testSetFactory().queryInterface(ITestSetFactory.class);
ITestSet testSet = factory.addItem(new Variant(Variant.Type.VT_NULL)).queryInterface(ITestSet.class);
testSet.name("Automatic Test Set");
testSet.status("Open");

testSet.field("CY_USER_04", "no schema used");
testSet.field("CY_USER_07", "Non-regression");
testSet.post();
testSet.unLockObject();

Otros consejos

You can do something similar to this:

            ITestSetTreeManager treeManager = connection.testSetTreeManager().queryInterface(ITestSetTreeManager.class);
            ITestSetFolder testSetFolder = treeManager.nodeByPath("Path/where/test/set/should/be/placed").queryInterface(ITestSetFolder.class);
            ITestSetFactory factory = testSetFolder.testSetFactory().queryInterface(ITestSetFactory.class);
            ITestSet testSet = factory.addItem(new Variant(Variant.Type.VT_NULL)).queryInterface(ITestSet.class);
            testSet.name("testSetName");
            testSet.status("Open");
            testSet.post();
            testSet.unLockObject();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top