Hello,
i want to create a Test-Suite in Silk Central Test Manager with a Filter by using a webservice. My Problem is, that i cannot set the Filter for the new suite by webservice but direct with a database update.
My SQL-Update-Code:
int nodeId = executionPlanningService.addNode(sessionId, project, node, parentIdOfSuite);
# After Adding the Node, i update the database:
String execFilter = "update TM_ExecutionDefinitions set FilterID_fk = " + filterOfSmoketest.getId() + " where ExecDefID_pk_fk = " + nodeId;
SCTMDatenbank.updateSQL(execFilter);
Is there a better way?
Is it possible that I only set a filter with webservice without a database update? If so, how can I use it?
Thanks,
Marcelo
Full-Code:
public static void main(String[] args) throws Exception {
SCTMWebservices.setIsTestSystem(true);
String sessionId = SCTMWebservices.login();
ExecutionPlanningService executionPlanningService = SCTMWebservices.getExecutionPlaningService();
int project = 69;
int testContainer = 353041;
String name = "Sample-Suite C";
String description = "Descrpition of the Sample-Suite";
String build = "DAILY-BUILD";
String version = "9.99_74";
int priority = 1;
String fakeExecutionDefinitions = "575987";
int parentIdOfSuite = 46221;
String keywords = "linux";
String filterName = "Smoketests";
// Search Filter by Name
Filter filterOfSmoketest = getFilter(sessionId, project, filterName);
// Build Propertys for new Node
PropertyValue eName = getNewProperty("PROP_NAME", "PROP_NAME", name, null);
PropertyValue eDescription = getNewProperty("PROP_DESC", "PROP_DESC", description, null);
PropertyValue eBuild = getNewProperty("PROP_BUILDNAME", "PROP_BUILDNAME", build, null);
PropertyValue eVersion = getNewProperty("PROP_VERSIONNAME", "PROP_VERSIONNAME", version, null);
PropertyValue eBuildInfo = getNewProperty("PROP_USE_BUILDINFOFILE", "PROP_USE_BUILDINFOFILE", Boolean.toString(false), null);
PropertyValue ePriority = getNewProperty("PROP_PRIORITY", "PROP_PRIORITY", Integer.toString(priority), null);
PropertyValue eTestContainer = getNewProperty("PROP_TESTCONTAINER", "PROP_TESTCONTAINER", Integer.toString(testContainer), null);
PropertyValue eRunExclusive = getNewProperty("PROP_RUNEXCLUSIVE", "PROP_RUNEXCLUSIVE", "true", null);
PropertyValue eRunDistributed = getNewProperty("PROP_RUNDISTRIBUTED", "PROP_RUNDISTRIBUTED", "true", null);
PropertyValue eExecutionDefintion = getNewProperty("PROP_ASSIGNED_TESTDEFS", "PROP_ASSIGNED_TESTDEFS", fakeExecutionDefinitions, null);
// Add new Suite
ExecutionNode node = new ExecutionNode();
node.setKind(3);
node.setPropertyValues(new PropertyValue[] { eName, eDescription, eBuild, eVersion, eBuildInfo, ePriority, eTestContainer, eExecutionDefintion , eRunExclusive, eRunDistributed});
int nodeId = executionPlanningService.addNode(sessionId, project, node, parentIdOfSuite);
// Set Filter in the database direkt
String execFilter = "update TM_ExecutionDefinitions set FilterID_fk = " + filterOfSmoketest.getId() + " where ExecDefID_pk_fk = " + nodeId;
SCTMDatenbank.updateSQL(execFilter);
// Set KeyWords
executionPlanningService.setKeywords(sessionId, nodeId, keywords.split(";"));
// Now you can run the Suite and it get the right filtered Tests
}