/// <summary> /// Verify a new upload file's task data, if there are any task data for a new upload file, method will throw a Assert.Fail exception. /// </summary> /// <param name="uploadedFileUrl">A parameter represents a URL of document item which the method check.</param> /// <param name="taskIndex">A parameter represents the index of a z:row item in a zrow collection. Each z:row item means a task item.It start on "Zero".</param> protected void VerifyAssignToValueForSingleTodoItem(string uploadedFileUrl, int taskIndex) { GetToDosForItemResponseGetToDosForItemResult todosAfterStartTask = ProtocolAdapter.GetToDosForItem(uploadedFileUrl); if (null == todosAfterStartTask || null == todosAfterStartTask.ToDoData || null == todosAfterStartTask.ToDoData.xml || null == todosAfterStartTask.ToDoData.xml.data || null == todosAfterStartTask.ToDoData.xml.data.Any) { this.Site.Assert.Fail("The response of GetToDosForItem operation should contain valid data."); } this.Site.Assert.AreEqual(1, todosAfterStartTask.ToDoData.xml.data.Any.Length, "The response of GetToDosForItem operation for new file should contain only one task data."); string expectedAssignToValue = Common.GetConfigurationPropertyValue("KeyWordForAssignedToField", this.Site).ToLower(); // Get the assign to value from actual response, "ows_AssignedTo" means get required field "AssignedTo" of task list. string actualAssignToValue = Common.GetZrowAttributeValue(todosAfterStartTask.ToDoData.xml.data.Any, taskIndex, "ows_AssignedTo"); this.Site.Assert.IsFalse(string.IsNullOrEmpty(actualAssignToValue), "The response of GetToDosForItem should contain valid value for [AssignedTo] field."); bool isassignToExpectedValue = actualAssignToValue.IndexOf(expectedAssignToValue, StringComparison.OrdinalIgnoreCase) >= 0; this.Site.Assert.IsTrue( isassignToExpectedValue, @"The actual ""AssignedTo"" value [{0}] should contain to expected keyword value[{1}]", actualAssignToValue, expectedAssignToValue); }
/// <summary> /// This operation is used to get a set of workflow tasks for specified document item in a document library. /// </summary> /// <param name="item">A parameter represents a URL which is point to a document item in a document library.</param> /// <returns>A return value represents a set of workflow tasks for specified document item </returns> public GetToDosForItemResponseGetToDosForItemResult GetToDosForItem(string item) { GetToDosForItemResponseGetToDosForItemResult getToDosForItemResult = null; try { getToDosForItemResult = this.wwspProxy.GetToDosForItem(item); } catch (SoapException) { this.CaptureHTTPStatusAndSoapFaultRequirements(); throw; } // Capture requirements this.CaptureTranstportAndSOAPRequirements(); this.CaptureXMLSchemaGetToDosForItem(); this.CaptureSoapInfoGetToDosForItem(); if (getToDosForItemResult != null) { this.CaptureToDoDataRelatedRequirements(getToDosForItemResult.ToDoData); } return(getToDosForItemResult); }
public void MSWWSP_S03_TC03_AlterToDo_IgnoreItem() { // Upload a file. string uploadFileUrl = this.UploadFileToSut(DocLibraryName); this.VerifyTaskDataOfNewUploadFile(uploadFileUrl); // Start a normal work flow string taskIdValue = this.StartATaskWithNewFile(uploadFileUrl, false); // Verify whether the task is assign to expected user group. for new uploaded file, only have one task currently. this.VerifyAssignToValueForSingleTodoItem(uploadFileUrl, 0); // initialize the value which will be updated in AlterToDo operation, and this value is unique. string alaterValueFirst = this.GenerateRandomValue(); // Call method AlterToDo to modify the values of fields on a workflow task. XmlElement taskData = this.GetAlerToDoTaskData(this.Site, alaterValueFirst); AlterToDoResponseAlterToDoResult alterToDoResult = ProtocolAdapter.AlterToDo(uploadFileUrl, int.Parse(taskIdValue), new Guid(TaskListId), taskData); // Call method GetToDosForItem to get a set of Workflow Tasks for a document. GetToDosForItemResponseGetToDosForItemResult todosAfterStartTask = ProtocolAdapter.GetToDosForItem(uploadFileUrl); var matchAttributeitemsFirst = from XmlAttribute attributeitem in todosAfterStartTask.ToDoData.xml.data.Any[0].Attributes where attributeitem.Value.Equals(alaterValueFirst, StringComparison.OrdinalIgnoreCase) select attributeitem; // initialize an not existing file Url. string notExistingFileUrl = this.GenerateRandomValue(); // initialize the value which will be updated in AlterToDo operation, and this value is unique. string alaterValueSecond = this.GenerateRandomValue(); // Call method AlterToDo to modify the values of fields on a workflow task. taskData = this.GetAlerToDoTaskData(this.Site, alaterValueSecond); alterToDoResult = ProtocolAdapter.AlterToDo(notExistingFileUrl, int.Parse(taskIdValue), new Guid(TaskListId), taskData); // Call method GetToDosForItem to get a set of Workflow Tasks for a document. todosAfterStartTask = ProtocolAdapter.GetToDosForItem(uploadFileUrl); var matchAttributeitemsSecond = from XmlAttribute attributeitem in todosAfterStartTask.ToDoData.xml.data.Any[0].Attributes where attributeitem.Value.Equals(alaterValueSecond, StringComparison.OrdinalIgnoreCase) select attributeitem; // Verify MS-WWSP requirement: MS-WWSP_R97 // If the altered value present in response of GetToDosForItem operation, the AlterToDo operation succeed. bool isVerifyR97 = matchAttributeitemsFirst.Count() == 1; // If the task is modified successfully in the first and second AlterToDo operation, then R97 should be covered. isVerifyR97 = isVerifyR97 && matchAttributeitemsSecond.Count() == 1; // Verify MS-WWSP requirement: MS-WWSP_R97 Site.CaptureRequirementIfIsTrue( isVerifyR97, 97, @"[In AlterToDo] Set the different string as the item value, server reply same if the site (2) of the SOAP request URL contains a list with the specified todoListId."); }
/// <summary> /// Get z:row attribute value by specified attribute name from a GetToDosForItemResponse /// </summary> /// <param name="getToDosForItemResponse">A parameter represents a GetToDosForItemResponse which contain zrow Attribute Values.</param> /// <param name="index">A parameter represents the index of a zrow item in a zrow collection.It start on "Zero".</param> /// <param name="expectedAttibuteName">A parameter represents the attributeName of which value will be return.</param> /// <returns>A return value represents the attribute value.</returns> protected string GetZrowAttributeValueFromGetToDosForItemResponse(GetToDosForItemResponseGetToDosForItemResult getToDosForItemResponse, int index, string expectedAttibuteName) { if (null == getToDosForItemResponse || null == getToDosForItemResponse.ToDoData || null == getToDosForItemResponse.ToDoData.xml) { throw new ArgumentException("The parameter should contain valid ToDoData.", "getToDosForItemResponse"); } XmlElement[] zrowDatas = getToDosForItemResponse.ToDoData.xml.data.Any; return(Common.GetZrowAttributeValue(zrowDatas, index, expectedAttibuteName)); }
/// <summary> /// Start workflow task for specified document item and record the task id in order to cleanup the task in test suite clean up process. /// </summary> /// <param name="uploadedFileUrl">A parameter represents a URL of document item where the task starts.</param> /// <param name="isClaim">A parameter represents a Boolean value indicate whether the task is started for Claim usage.</param> /// <returns>A return value represents the id of the task started by this method.</returns> protected string StartATaskWithNewFile(string uploadedFileUrl, bool isClaim) { if (string.IsNullOrEmpty(uploadedFileUrl)) { throw new ArgumentException("Should specify valid value to indicate the URL of a uploaded file", "uploadedFileUrl"); } GetToDosForItemResponseGetToDosForItemResult todosInfo = null; try { XmlElement startWorkFlowData = null; if (isClaim) { startWorkFlowData = this.GetStartWorkflowParameterForClaim(this.Site); } else { string assignToUserValue = Common.GetConfigurationPropertyValue("MSWWSPTestAccount", this.Site); startWorkFlowData = this.GetStartWorkflowParameter(this.Site, assignToUserValue); } Guid currentWorkflowAsscociationId = new Guid(WorkflowAssociationId); ProtocolAdapter.StartWorkflow(uploadedFileUrl, currentWorkflowAsscociationId, startWorkFlowData); todosInfo = ProtocolAdapter.GetToDosForItem(uploadedFileUrl); } catch (SoapException soapEx) { throw new Exception("There are errors generated during start workflow task and GetToDos process.", soapEx); } // Get the task id from the response. there have only one task data in the response, because test suite only start one for new upload file. string taskId = this.GetZrowAttributeValueFromGetToDosForItemResponse(todosInfo, 0, "ows_ID"); if (string.IsNullOrEmpty(taskId)) { this.Site.Assert.Fail("Could Not get the id of started task from the document item[{0}]", uploadedFileUrl); } StartedTaskIdsRecorder.Add(taskId); return(taskId); }
/// <summary> /// Verify a new upload file's task data, if there are any task data for a new upload file, method will throw a Assert.Fail exception. /// </summary> /// <param name="uploadedFileUrl">A parameter represents a URL of document item which the method check.</param> protected void VerifyTaskDataOfNewUploadFile(string uploadedFileUrl) { if (string.IsNullOrEmpty(uploadedFileUrl)) { throw new ArgumentException("Should specify valid value to indicate the URL of a uploaded file", "uploadedFileUrl"); } GetToDosForItemResponseGetToDosForItemResult gettodosResult = ProtocolAdapter.GetToDosForItem(uploadedFileUrl); this.Site.Assert.IsNotNull(gettodosResult, "The response of GetToDosForItem operation should have instance."); // Verify there are no any task data for the new upload file. if (gettodosResult.ToDoData != null && gettodosResult.ToDoData.xml != null && gettodosResult.ToDoData.xml != null && gettodosResult.ToDoData.xml.data != null && gettodosResult.ToDoData.xml.data.Any != null && gettodosResult.ToDoData.xml.data.Any.Length > 0) { this.Site.Assert.Fail( "The response of GetToDosForItem operation should not contain any task data for a new uploaded file, actual task number:[{0}]", gettodosResult.ToDoData.xml.data.Any.Length); } }
public void MSWWSP_S02_TC02_GetToDosForItem_ToDoData() { // Upload a file. string uploadFileUrl = this.UploadFileToSut(DocLibraryName); // If there are any existing task for new uploaded file, this method will throw an exception. this.VerifyTaskDataOfNewUploadFile(uploadFileUrl); // Start a normal work flow this.StartATaskWithNewFile(uploadFileUrl, false); // Call method GetToDosForItem to get a set of Workflow Tasks for a document. GetToDosForItemResponseGetToDosForItemResult getTodosResult = ProtocolAdapter.GetToDosForItem(uploadFileUrl); if (getTodosResult == null || getTodosResult.ToDoData == null || getTodosResult.ToDoData.xml == null || getTodosResult.ToDoData.xml.data == null || getTodosResult.ToDoData.xml.data.Any == null) { this.Site.Assert.Fail("GetToDosForItem operation is failed."); } // Verify whether the task is assign to expected user group. for new uploaded file, only have one task currently. this.VerifyAssignToValueForSingleTodoItem(uploadFileUrl, 0); // If the number of the workflow tasks is greater than or equal to 1, then R409, R173, R179, R188 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R409 Site.CaptureRequirementIfIsTrue( getTodosResult.ToDoData.xml.data.Any.Length >= 1, 409, @"[In Message Processing Events and Sequencing Rules] GetToDosForItem obtains a set of workflow tasks for an existing document."); // Verify MS-WWSP requirement: MS-WWSP_R173 Site.CaptureRequirementIfIsTrue( getTodosResult.ToDoData.xml.data.Any.Length >= 1, 173, @"[In GetToDosForItem] This operation obtains a set of workflow tasks for a document."); // Verify MS-WWSP requirement: MS-WWSP_R179 Site.CaptureRequirementIfIsTrue( getTodosResult.ToDoData.xml.data.Any.Length >= 1, 179, @"[In Messages] GetToDosForItemSoapOut specifies the response to a request for a set of workflow tasks for a document."); // Verify MS-WWSP requirement: MS-WWSP_R188 Site.CaptureRequirementIfIsTrue( getTodosResult.ToDoData.xml.data.Any.Length >= 1, 188, @"[In Elements] GetToDosForItemResponse contains the response to a request for a set of workflow tasks for a document."); // If the response from the GetToDosForItem operation is not null, then R176 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R176 Site.CaptureRequirementIfIsNotNull( getTodosResult, 176, @"[In GetToDosForItem] The protocol client sends a GetToDosForItemSoapIn request message, and the protocol server responds with a GetToDosForItemSoapOut response message."); // If the element of the ToDoData is not null, then R32 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R32 Site.CaptureRequirementIfIsNotNull( getTodosResult.ToDoData, 32, @"[In Elements] ToDoData specifies a set of workflow tasks."); }
public void MSWWSP_S03_TC01_AlterToDo_Success() { // Upload a file. string uploadFileUrl = this.UploadFileToSut(DocLibraryName); this.VerifyTaskDataOfNewUploadFile(uploadFileUrl); // Start a normal work flow string taskIdValue = this.StartATaskWithNewFile(uploadFileUrl, false); // Verify whether the task is assign to expected user group. for new uploaded file, only have one task currently. this.VerifyAssignToValueForSingleTodoItem(uploadFileUrl, 0); // initialize the value which will be updated in AlterToDo operation, and this value is unique. string alaterValue = this.GenerateRandomValue(); // initialize a SoapException instance. bool isSuccessAlterToDo = false; AlterToDoResponseAlterToDoResult alterToDoResult = new AlterToDoResponseAlterToDoResult(); try { // Call method AlterToDo to modify the values of fields on a workflow task. XmlElement taskData = this.GetAlerToDoTaskData(this.Site, alaterValue); alterToDoResult = ProtocolAdapter.AlterToDo(uploadFileUrl, int.Parse(taskIdValue), new Guid(TaskListId), taskData); isSuccessAlterToDo = true; } catch (SoapException ex) { isSuccessAlterToDo = false; this.Site.Assert.Fail("AlterToDo operation is failed." + ex.ToString()); } // Call method GetToDosForItem to get a set of Workflow Tasks for a document. GetToDosForItemResponseGetToDosForItemResult todosAfterStartTask = ProtocolAdapter.GetToDosForItem(uploadFileUrl); var matchAttributeitems = from XmlAttribute attributeitem in todosAfterStartTask.ToDoData.xml.data.Any[0].Attributes where attributeitem.Value.Equals(alaterValue, StringComparison.OrdinalIgnoreCase) select attributeitem; // If the specified workflow task is be modified, then R70, R77, R83, R415, R93 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R70 Site.CaptureRequirementIfAreEqual( 1, matchAttributeitems.Count(), 70, @"[In Message Processing Events and Sequencing Rules]The operation AlterToDo modifies a workflow task."); // Verify MS-WWSP requirement: MS-WWSP_R77 Site.CaptureRequirementIfAreEqual( 1, matchAttributeitems.Count(), 77, @"[In AlterToDo] This operation is used to modify the values of Fields on a workflow task."); // Verify MS-WWSP requirement: MS-WWSP_R83 Site.CaptureRequirementIfAreEqual( 1, matchAttributeitems.Count(), 83, @"[In Messages] AlterToDoSoapOut specifies the response to a request to modify the values of Fields on a workflow task."); // Verify MS-WWSP requirement: MS-WWSP_R415 Site.CaptureRequirementIfAreEqual( 1, matchAttributeitems.Count(), 415, @"[In Elements] AlterToDoResponse contains the response to a request to modify the values of Fields on a workflow task."); // Verify MS-WWSP requirement: MS-WWSP_R93 Site.CaptureRequirementIfAreEqual( 1, matchAttributeitems.Count(), 93, @"[In AlterToDo] This element[AlterToDo] is sent with AlterToDoSoapIn and specifies the workflow task to be modified, as well as the fields and values to be modified."); // If the response from the AlterToDo operation is not null, then R80 and R102 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R80 Site.CaptureRequirementIfIsNotNull( alterToDoResult, 80, @"[In AlterToDo] The protocol client sends an AlterToDoSoapIn request message, and the protocol server responds with an AlterToDoSoapOut response message."); // Verify MS-WWSP requirement: MS-WWSP_R102 Site.CaptureRequirementIfIsNotNull( alterToDoResult, 102, @"[In AlterToDoResponse] This element is sent with AlterToDoSoapOut and specifies whether the AlterToDo operation was successful."); // If AlterToDoResult.fSuccess is equal to 1, then R105 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R105 Site.CaptureRequirementIfAreEqual( 1, alterToDoResult.fSuccess, 105, @"[In AlterToDoResponse] AlterToDoResult.fSuccess: If the operation[AlterToDo] was successful, this[AlterToDoResult.fSuccess] MUST be set to 1."); // If there is no soap exception, then R108 and R109 should be covered. // Verify MS-WWSP requirement: MS-WWSP_R108 bool isVerifyR108 = isSuccessAlterToDo; Site.CaptureRequirementIfIsTrue( isVerifyR108, 108, @"[In AlterToDoResponse]The success of this operation[AlterToDo] MUST NOT substitute for a SOAP fault [or HTTP Status Code] in the case of a protocol server fault."); // Verify MS-WWSP requirement: MS-WWSP_R109 bool isVerifyR109 = isSuccessAlterToDo; Site.CaptureRequirementIfIsTrue( isVerifyR109, 109, @"[In AlterToDoResponse] The success of this operation[AlterToDo] MUST NOT substitute for [a SOAP fault or] HTTP Status Code in the case of a protocol server fault."); }
public void MSWWSP_S01_TC01_StartWorkflow_Success() { // Upload a file. string uploadFileUrl = this.UploadFileToSut(DocLibraryName); this.VerifyTaskDataOfNewUploadFile(uploadFileUrl); // Start work flow string assigntoUserName = CurrentProtocolPerformAccountName; XmlElement starworkflowParameter = this.GetStartWorkflowParameter(this.Site, assigntoUserName); Guid targetWorkflowAssociationGuid = new Guid(WorkflowAssociationId); ProtocolAdapter.StartWorkflow(uploadFileUrl, targetWorkflowAssociationGuid, starworkflowParameter); try { ProtocolAdapter.StartWorkflow(uploadFileUrl, targetWorkflowAssociationGuid, starworkflowParameter); } catch (SoapException) { //Verify requirement: MS-WWSP_R327001 Site.CaptureRequirement( 327001, @"[In StartWorkflow] The protocol server MUST NOT start multiple workflow instances of the same item and same workflow association using this operation."); } GetToDosForItemResponseGetToDosForItemResult todosAfterStartTask = ProtocolAdapter.GetToDosForItem(uploadFileUrl); if (null == todosAfterStartTask || null == todosAfterStartTask.ToDoData || null == todosAfterStartTask.ToDoData.xml || null == todosAfterStartTask.ToDoData.xml.data || null == todosAfterStartTask.ToDoData.xml.data.Any) { this.Site.Assert.Fail("The response of GetToDosForItem operation should contain valid data."); } // Record the started tasks string taskId = this.GetZrowAttributeValueFromGetToDosForItemResponse(todosAfterStartTask, 0, "ows_ID"); StartedTaskIdsRecorder.Add(taskId); this.Site.Assert.AreEqual(1, todosAfterStartTask.ToDoData.xml.data.Any.Length, "The response of GetToDosForItem operation for new file should contain only one task data."); assigntoUserName = assigntoUserName.ToLower(); // Get the assign to value from actual response, "ows_AssignedTo" means get required field "AssignedTo" of task list. string actualAssignToValue = Common.GetZrowAttributeValue(todosAfterStartTask.ToDoData.xml.data.Any, 0, "ows_AssignedTo"); this.Site.Assert.IsFalse(string.IsNullOrEmpty(actualAssignToValue), "The response of GetToDosForItem should contain valid value for [AssignedTo] field."); bool isassignToExpectedValue = actualAssignToValue.IndexOf(assigntoUserName, StringComparison.OrdinalIgnoreCase) >= 0; Site.Log.Add( LogEntryKind.Debug, "The actual value: assigntoUserName[{0}], actualAssignToValue[{1}] for requirement #R412, #R324, #R327, #R330, #R339", assigntoUserName, actualAssignToValue); // If start a new workflow instance and assign to expected user, capture #R412, R324, R327, R330, R339 this.Site.CaptureRequirementIfIsTrue( isassignToExpectedValue, 412, @"[In Message Processing Events and Sequencing Rules] StartWorkflow instantiates a new workflow for an existing document and a workflow association."); this.Site.CaptureRequirementIfIsTrue( isassignToExpectedValue, 324, @"[In StartWorkflow] This operation[StartWorkflow] starts a new workflow, generating a workflow from a workflow association."); this.Site.CaptureRequirementIfIsTrue( isassignToExpectedValue, 327, @"[In StartWorkflow] The protocol client sends a StartWorkflowSoapIn request message, and the protocol server responds with a StartWorkflowSoapOut response message."); this.Site.CaptureRequirementIfIsTrue( isassignToExpectedValue, 330, @"[In Messages] StartWorkflowSoapOut specifies the response to a request to start a new workflow."); this.Site.CaptureRequirementIfIsTrue( isassignToExpectedValue, 339, @"[In Elements] StartWorkflowResponse contains the response to a request to start a new workflow."); }