java - Not Able to Access Testcases Under Testplan Using OTA -
i tried writing code getting null pointer exception. tried multiple solutions not able figure out problem. appreciated.
my flow of execution : subject -> test -> tc1(testcase)
itestsettreemanager treemanagerplan = qcconnection.testsettreemanager().queryinterface(itestsettreemanager.class); itestsetfolder basefolderplan = treemanagerplan.root().queryinterface(itestsetfolder.class); string foldernamesplan[] = null; testsetfolderplan=null; if(strtestplanpath.contains("\\")) { foldernamesplan = strtestplanpath.split("\\\\"); for(int i=1;i<foldernamesplan.length;i++) { system.out.println("qc folder parsing.." + foldernamesplan[i]); if(!foldernamesplan[i].equals("")) { boolean createfolder = true; for(int f=0; f< basefolderplan.count(); f++) { try{ if(basefolderplan.findchildnode(foldernamesplan[i]).name().equalsignorecase(foldernamesplan[i])) { createfolder=false; break; } }catch(exception ex) { system.out.println("not able access folder"); } } testsetfolderplan = treemanagerplan.nodebyid(basefolderplan.findchildnode(foldernamesplan[i]).nodeid()).queryinterface(itestsetfolder.class); basefolderplan=testsetfolderplan; system.out.println("basefolder>>>>>>>>>>>>>>>>"+basefolderplan.name()); itestfactory itestfactory = qcconnection.testfactory().queryinterface(itestfactory.class); ibasefactory testfactory = tstest.tstestfactory().queryinterface(ibasefactory.class); ilist tststlist = testfactory.newlist(""); string tsname = null; for(com4jobject obj4:tststlist) { itstest tstest = obj4.queryinterface(itstest.class); tsname=(string) tstest.testid();//.name(); system.out.println("testcase description "+tstest.name()+"\n qc id : "+ tsname); } // ilist testinstances = testfactory.newlist(""); com4jobject comobjtest = itestfactory.item(tsname); itest itest = comobjtest.queryinterface(itest.class); com4jobject subjectfield = (com4jobject)itest.field("ts_subject"); isubjectnode subfolder = subjectfield.queryinterface(isubjectnode.class); system.out.println(subfolder.name()); /* isubjectnode node = qcconnection.testfactory().queryinterface(isubjectnode.class); system.out.println(node.name()); ilist list = node.newlist(); (com4jobject isys : list) { system.out.println("test folder : "+ isys.queryinterface(isystreenode.class).name()); }*/ }
Comments
Post a Comment