updateExecutionDefinitions Interface

The updateExecutionDefinitions interface is used to update execution plans from XML files. The HTTP response of the call contains the XML structure of the changed execution plans. You can obtain the identifiers of the new nodes from the updated XML execution plan structure.

The following table shows the parameters of the updateExecutionDefinitions interface.

Interface URL Parameter Descriptions

http://<front-end URL>/servicesExchange?hid=updateExecutionDefinitions

sid Web-service token or session identifier for user authentication. You can generate the web-service token in the Settings Page of the Silk Central UI. To access this page, hover the mouse cursor over the user name in the Silk Central menu and select User Settings. You can retrieve the session identifier by invoking the logonUser method of one of the Available Web Services.

Example: http://<front-end URL>/servicesExchange?hid=updateExecutionDefinitions&sid=<webServiceToken>

The XML schema definition file that is used to validate executions can be downloaded by using the front-end server URL http://<front-end URL>/silkroot/xsl/executionplan.xsd or copied from the front-end server installation folder <Silk Central installation folder>/wwwroot/silkroot/xsl/executionplan.xsd.

updateExecutionDefinitions Web Service Example

The following code uses Apache HttpClient to update execution plans.

import org.apache.commons.httpclient.*; // Apache HttpClient
		
String webServiceToken = "e39a0b5b-45db-42db-84b2-b85028d954d5";
string xml = loadExecutionPlanUtf8(DEMO_EXECUTION_PLAN_XML);
HttpClient client = new HttpClient();

URL webServiceUrl = new URL("http", mWebServiceHelper.getHost(),
  mWebServiceHelper.getPort(), 
  String.format("/servicesExchange?hid=%s&sid=%s",
    "updateExecutionDefinitions",
    webServiceToken));
StringPart ExecutionPlanXml = new StringPart(DEMO_EXECUTION_PLAN_XML, xml,
  "UTF-8");
ExecutionPlanXml.setContentType("text/xml");
Part[] parts = {ExecutionPlanXml};
PostMethod filePost = new PostMethod(webServiceUrl.toExternalForm());
filePost.setRequestEntity(new MultipartRequestEntity(parts,
  filePost.getParams()));
client.getHttpConnectionManager().getParams().setConnectionTimeout(60000);
int status = client.executeMethod(filePost);
System.out.println(filePost.getStatusLine());

String responseXml = filePost.getResponseBodyAsString();

Only one attachment can be uploaded per request. To download Apache HttpComponents, visit http://hc.apache.org/downloads.cgi. Refer to the documentation of the component for the required libraries.

Execution Plan Example

The following code shows an example execution plan that can be uploaded to Silk Central by using the createExecutionDefinitions and updateExecutionDefinitions service. The example creates a custom schedule for one of the execution definitions and assigns tests to an execution plan, both through a manual assignment and a filter. The example also creates a configuration suite with configurations.

<?xml version="1.0" encoding="UTF-8"?>
<ExecutionPlan xmlns="http://www.borland.com/ExecPlanSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://<front-end URL>/silkroot/xsl/executionplan.xsd">

  <Folder name="Folder1"> 
    <Description>Description of the folder</Description>
    <ExecDef name="ExecutionDefinition1" TestContainerId="1">
      <Description>Description1</Description>
      <CustomSchedule>
        <start>2009-11-26T21:32:52</start>
        <end>
          <forever>true</forever>
        </end>
        <Interval day="1" hour="2" minute="3"></Interval>
        <adjustDaylightSaving>false</adjustDaylightSaving>
        <exclusions>
          <days>Monday</days>
          <days>Wednesday</days>
          <from>21:32:52</from>
          <to>22:32:52</to>
        </exclusions>
        <definiteRun>2009-11-27T21:35:12</definiteRun>
      </CustomSchedule>            
      <ReadFromBuildInfoFile>true</ReadFromBuildInfoFile>
      <Priority>High</Priority>
      <SetupTestDefinition>73</SetupTestDefinition>
      <CleanupTestDefinition>65</CleanupTestDefinition>
      <AssignedTestDefinitions>
        <ManualAssignment useTestPlanOrder="true">
          <TestId>6</TestId>
          <TestId>5</TestId>
        </ManualAssignment>
      </AssignedTestDefinitions>
    </ExecDef>
    <ExecDef name="ExecutionDefinition2" TestContainerId="1">
      <Description>Description2</Description>
      <Build>1</Build>
      <Version>1</Version>
      <Priority>Low</Priority>
      <SourceControlLabel>Label1</SourceControlLabel>
      <DependentExecDef id="65">
        <Condition>Passed</Condition>
        <Deployment>
          <Specific>
            <Execution type="Server" id="1"/>
            <Execution type="Tester" id="0"/>
          </Specific>
        </Deployment>
      </DependentExecDef>
      <DependentExecDef id="70">
        <Condition>Failed</Condition>
        <Deployment>
          <Specific>
            <Execution type="Tester" id="0"/>
          </Specific>
        </Deployment>
      </DependentExecDef>
      <DependentExecDef id="68">
        <Condition>Any</Condition>
        <Deployment>
          <UseFromCurrentExedDef>true</UseFromCurrentExedDef>
        </Deployment>
      </DependentExecDef>
    </ExecDef>

    <ConfigSuite name="ConfigSuite1" TestContainerId="1">
      <Description>ConfigSuite1 desc</Description>
      <CustomSchedule>
        <start>2009-11-26T21:32:52</start>
        <end>
          <times>1</times>
        </end>
        <Interval day="1" hour="2" minute="3"/>
        <adjustDaylightSaving>false</adjustDaylightSaving>
        <exclusions>
          <days>Monday</days>
          <days>Wednesday</days>
          <from>21:32:52</from>
          <to>22:32:52</to>
        </exclusions>
        <definiteRun>2009-11-27T21:35:12</definiteRun>
      </CustomSchedule>

      <ConfigExecDef name="Config1">
        <Description>Config1 desc</Description>
        <Priority>Medium</Priority>
      </ConfigExecDef>

      <ConfigExecDef name="Config2">
        <Priority>Medium</Priority>
        <DependentExecDef id="69">
          <Condition>Any</Condition>
          <Deployment>
            <UseFromCurrentExedDef>true</UseFromCurrentExedDef>
          </Deployment>
        </DependentExecDef>
      </ConfigExecDef>

      <Build>8</Build>
      <Version>2</Version>
      <SourceControlLabel>ConfigSuite1 label</SourceControlLabel>
      <SetupTestDefinition>73</SetupTestDefinition>
      <CleanupTestDefinition>65</CleanupTestDefinition>
      <AssignedTestDefinitions>
        <ManualAssignment useTestPlanOrder="true">
          <TestId>6</TestId>
          <TestId>5</TestId>
        </ManualAssignment>
      </AssignedTestDefinitions>
    </ConfigSuite>    
  </Folder>
</ExecutionPlan>