ct_pqm_entw Absent Member.
Absent Member.
505 views

Create Test-Suite in Silk Central Test Manager with Filter using Webservices

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

}
0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

RE: Create Test-Suite in Silk Central Test Manager with Filter using Webservices

Hi,

Pls re-post this question in the Silk Central forum (community.microfocus.com/.../forum)

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.