From a8280b7c0cc4e1367fe44f11c251111432061c53 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Wed, 8 Jan 2014 10:23:53 -0400 Subject: [PATCH 1/3] Behat para activity resources --- .../activity.feature | 132 +++++++++++++++--- features/bootstrap/RestContext.php | 17 +++ 2 files changed, 132 insertions(+), 17 deletions(-) diff --git a/features/backend/project_activity_resources/activity.feature b/features/backend/project_activity_resources/activity.feature index 6bfbd5200..6c2f856bc 100644 --- a/features/backend/project_activity_resources/activity.feature +++ b/features/backend/project_activity_resources/activity.feature @@ -1,21 +1,119 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Project Activity Resources +Feature: Testing activity + @1: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- + Scenario: Get a activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the "definition" property type is "array" + And that "tas_title" is set to "Task 1" - Background: - Given that I have a valid access_token - Scenario: Get properties & definition of a activity. - Given this scenario is not implemented yet - - Scenario: Get BPMN definition of an activity. - Given this scenario is not implemented yet - - Scenario: Get properties data of the ProcessMaker engine of an activity. - Given this scenario is not implemented yet - - Scenario: Update definition & properties of an activity - Given this scenario is not implemented yet - - Scenario: Delete a project activity - Given this scenario is not implemented yet + @2: TEST FOR GET PROPERTIES ACTIVITY /--------------------------------------------------------- + Scenario: Get properties of activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=properties" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the response not has a "definition" property + + @3: TEST FOR GET DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Get definition of activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=definition" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the response not has a "properties" property + + + @4: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Put propertie of activity + Given that I have a valid access_token + And PUT this data: + """ + { + "definition": [], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": null, + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task Edit", + "tas_description": "", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } + } + """ + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + + @5: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- + Scenario: Get a activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "tas_title" is set to "Task Edit" + + + @6: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Put propertie of activity + Given that I have a valid access_token + And PUT this data: + """ + { + "definition": [], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": null, + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task 1", + "tas_description": "", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } + } + """ + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index b498ca832..258e204b8 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -698,6 +698,23 @@ class RestContext extends BehatContext } } + /** + * @Given /^the response not has a "([^"]*)" property$/ + * @Given /^the response not has an "([^"]*)" property$/ + * @Given /^the response not has a property called "([^"]*)"$/ + * @Given /^the response not has an property called "([^"]*)"$/ + */ + public function theResponseNotHasAProperty($propertyName) + { + $data = $this->_data; + + if (!empty($data)) { + if (isset($data->$propertyName)) { + throw new Exception("Property '$propertyName' is set!\n\n"); + } + } + } + /** * @Then /^the "([^"]*)" property equals "([^"]*)"$/ */ From 88b3fb570ccddb6fc279d08a972eadc940ddc4d8 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Wed, 8 Jan 2014 10:28:06 -0400 Subject: [PATCH 2/3] Arreglo de conflicto --- .../activity.feature | 165 ++++++------------ 1 file changed, 49 insertions(+), 116 deletions(-) diff --git a/features/backend/project_activity_resources/activity.feature b/features/backend/project_activity_resources/activity.feature index 6c2f856bc..5c16fa02c 100644 --- a/features/backend/project_activity_resources/activity.feature +++ b/features/backend/project_activity_resources/activity.feature @@ -1,119 +1,52 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Testing activity - @1: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- - Scenario: Get a activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the type is "object" - And the "definition" property type is "array" - And that "tas_title" is set to "Task 1" +Feature: Project Activity Resources + Background: + Given that I have a valid access_token - @2: TEST FOR GET PROPERTIES ACTIVITY /--------------------------------------------------------- - Scenario: Get properties of activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=properties" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the type is "object" - And the response not has a "definition" property - - - @3: TEST FOR GET DEFINITION ACTIVITY /--------------------------------------------------------- - Scenario: Get definition of activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=definition" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the type is "object" - And the response not has a "properties" property - - - @4: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- - Scenario: Put propertie of activity - Given that I have a valid access_token - And PUT this data: - """ - { - "definition": [], - "properties": { - "tas_type": "NORMAL", - "tas_duration": 1, - "tas_type_day": "", - "tas_timeunit": "DAYS", - "tas_priority_variable": "", - "tas_assign_type": "BALANCED", - "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", - "tas_group_variable": null, - "tas_transfer_fly": "FALSE", - "tas_send_last_email": "FALSE", - "tas_derivation_screen_tpl": "", - "tas_selfservice_timeout": 0, - "tas_selfservice_time": "", - "tas_selfservice_time_unit": "", - "tas_selfservice_trigger_uid": "", - "tas_title": "Task Edit", - "tas_description": "", - "tas_def_title": "", - "tas_def_description": "", - "tas_def_message": "", - "tas_def_subject_message": "", - "tas_calendar": "" - } - } - """ - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the type is "object" - - - @5: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- - Scenario: Get a activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the type is "object" - And that "tas_title" is set to "Task Edit" - - - @6: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- - Scenario: Put propertie of activity - Given that I have a valid access_token - And PUT this data: - """ - { - "definition": [], - "properties": { - "tas_type": "NORMAL", - "tas_duration": 1, - "tas_type_day": "", - "tas_timeunit": "DAYS", - "tas_priority_variable": "", - "tas_assign_type": "BALANCED", - "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", - "tas_group_variable": null, - "tas_transfer_fly": "FALSE", - "tas_send_last_email": "FALSE", - "tas_derivation_screen_tpl": "", - "tas_selfservice_timeout": 0, - "tas_selfservice_time": "", - "tas_selfservice_time_unit": "", - "tas_selfservice_trigger_uid": "", - "tas_title": "Task 1", - "tas_description": "", - "tas_def_title": "", - "tas_def_description": "", - "tas_def_message": "", - "tas_def_subject_message": "", - "tas_calendar": "" - } - } - """ - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the type is "object" \ No newline at end of file + Scenario: Get properties & definition of a activity. + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + + + Scenario: Get BPMN definition of an activity. + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485?filter=definition" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + + Scenario: Get properties data of the ProcessMaker engine of an activity. + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485?filter=properties" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + + Scenario: Update definition & properties of an activity + Given PUT data from file "activity_update_properties.json" + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" + Then the response status code should be 200 + + Scenario: Get properties & definition of an updated activity. + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And the response is equivalent to this json file "activity_update_properties.json" + + Scenario: Delete a project activity + Given that I want to delete "activity" + And I request "project/4224292655297723eb98691001100052/activity/95897010052ccb746c770b6003171032" + Then the response status code should be 200 + + Scenario: Get properties & definition of a activity (subprocess) + Given I request "project/4224292655297723eb98691001100052/activity/68065066252ccb7913b9be6048174072" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" \ No newline at end of file From 6c56092d9cec147e60f81394adffa0a3011765c5 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Wed, 8 Jan 2014 10:33:43 -0400 Subject: [PATCH 3/3] Pruebas behat para activitys --- .../activity.feature | 165 ++++++++++++------ 1 file changed, 116 insertions(+), 49 deletions(-) diff --git a/features/backend/project_activity_resources/activity.feature b/features/backend/project_activity_resources/activity.feature index c33a3c958..6c2f856bc 100644 --- a/features/backend/project_activity_resources/activity.feature +++ b/features/backend/project_activity_resources/activity.feature @@ -1,52 +1,119 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Project Activity Resources +Feature: Testing activity + @1: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- + Scenario: Get a activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the "definition" property type is "array" + And that "tas_title" is set to "Task 1" - Background: - Given that I have a valid access_token - Scenario: Get properties & definition of a activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - - - Scenario: Get BPMN definition of an activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485?filter=definition" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - - Scenario: Get properties data of the ProcessMaker engine of an activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485?filter=properties" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - - Scenario: Update definition & properties of an activity - Given PUT data from file "activity_update_properties.json" - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" - Then the response status code should be 200 - - Scenario: Get properties & definition of an updated activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - And the response is equivalent to this json file "activity_update_properties.json" - - Scenario: Delete a project activity - Given that I want to delete "activity" - And I request "project/4224292655297723eb98691001100052/activity/95897010052ccb746c770b6003171032" - Then the response status code should be 200 - - Scenario: Get properties & definition of a activity (subprocess) - Given I request "project/4224292655297723eb98691001100052/activity/68065066252ccb7913b9be6048174072" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" + @2: TEST FOR GET PROPERTIES ACTIVITY /--------------------------------------------------------- + Scenario: Get properties of activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=properties" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the response not has a "definition" property + + + @3: TEST FOR GET DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Get definition of activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=definition" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the response not has a "properties" property + + + @4: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Put propertie of activity + Given that I have a valid access_token + And PUT this data: + """ + { + "definition": [], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": null, + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task Edit", + "tas_description": "", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } + } + """ + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + + @5: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- + Scenario: Get a activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "tas_title" is set to "Task Edit" + + + @6: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Put propertie of activity + Given that I have a valid access_token + And PUT this data: + """ + { + "definition": [], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": null, + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task 1", + "tas_description": "", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } + } + """ + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" \ No newline at end of file