From 7f8488aac5d7420aa1d473af378fc18896f80fa5 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 8 May 2014 09:37:44 -0400 Subject: [PATCH 1/3] Avance de los features pmtable, modificacion de sintaxis en feature case actions y adicion de nueva funcion en RestContext para realizar import de un project --- .../basic_sequence_pm_tables.feature | 140 ++++++++------ .../pm_tables/main_tests_pm_tables.feature | 173 ++++++++++++------ .../main_tests_cases_actions.feature | 1 - features/bootstrap/RestContext.php | 15 ++ 4 files changed, 223 insertions(+), 106 deletions(-) diff --git a/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature b/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature index 89bf37536..b30e8242c 100644 --- a/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature +++ b/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature @@ -66,8 +66,9 @@ Scenario Outline: Create new pmtable Examples: - | test_description | pmt_uid_number | pmt_tab_name | pmt_tab_dsc | - | Create pmtable with fields defined | 1 | PMT_Test_QA | pmt table created with script | + | test_description | pmt_uid_number | pmt_tab_name | pmt_tab_dsc | + | Create pmtable with fields defined | 1 | PMT_Test_QA | pmt table created with script | + | Create pmtable for test data | 2 | PMT_DAT_QA | pmt para realizar el testeo del borrado del data | Scenario Outline: Create a new Data of pm table. @@ -88,6 +89,42 @@ Scenario Outline: Create a new Data of pm table. | pmt_uid_number | | 1 | + | 2 | + + +Scenario Outline: Update a a data of pm table + Given PUT this data: + """ + { + "CAMPO1" : "valor1", + "CAMPO2" : "updatevalor2" + } + """ + And that I want to update a "PM Table" + And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | pmt_uid_number | + | 1 | + + +Scenario Outline: Get data of the PMTABLE + Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + 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 that "CAMPO1" is set to "valor1" + And that "CAMPO2" is set to "updatevalor2" + + Examples: + + | pmt_uid_number | + | 1 | Scenario Outline: Update a pm table of a project @@ -136,49 +173,63 @@ Examples: | 1 | -Scenario Outline: Update a a data of pm table - Given PUT this data: - """ - { - "CAMPO1" : "valor1", - "CAMPO2" : "updatevalor2" - } - """ - And that I want to update a "PM Table" - And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - And the content type is "application/json" - Then the response status code should be 200 - And the response charset is "UTF-8" - - Examples: - - | pmt_uid_number | - | 1 | - - -Scenario Outline: Get data of the PMTABLE - Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - 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 that "CAMPO1" is set to "valor1" - And that "CAMPO2" is set to "updatevalor2" - - Examples: - - | pmt_uid_number | - | 1 | - Scenario: Get the PMTABLE List when there are exactly ONE pmtables in this workspace Given I request "pmtable" 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 "array" - And the response has 2 records + And the response has 3 records +#Test delete of Data + +Scenario Outline: Update a pm table of a project + Given PUT this data: + """ + { + "rep_tab_dsc" : "descripcion de la tabla", + "fields" : [ + { + "fld_key" : 1, + "fld_name" : "UPDATECAMPO", + "fld_label" : "UPDATECAMPO", + "fld_type" : "VARCHAR", + "fld_size" : 200 + + } + ] + } + """ + And that I want to update a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | pmt_uid_number | + | 2 | + + +Scenario Outline: Get a single the PMTABLE after update + Given that I want to get a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + 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 has 0 records + +Examples: + + | pmt_uid_number | + | 2 | + + +#Delete PM Tables + Scenario Outline: Delete a pm table of a pmtable Given that I want to delete a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" And I request "pmtable" @@ -191,20 +242,7 @@ Scenario Outline: Delete a pm table of a pmtable | pmt_uid_number | | 1 | - - -Scenario Outline: Delete a data of a pmtable - Given that I want to delete a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" - And I request "pmtable//data/CAMPO1/valor1" - And the content type is "application/json" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the type is "object" - - Examples: - - | pmt_uid_number | - | 1 | + | 2 | Scenario: Get the PMTABLE List when there are exactly ONE pmtables in this workspace diff --git a/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature b/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature index 61bd92da3..cc0eecdda 100644 --- a/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature +++ b/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature @@ -117,9 +117,9 @@ Scenario Outline: Create a new Data of pm table. Given POST this data: """ { - "UNO" : "", - "CAMPO1" : "QA", - "CAMPO2" : "" + "UNO" : "QA11", + "DOS" : "QA22", + "TRES" : "QA33" } """ And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" @@ -130,14 +130,54 @@ Scenario Outline: Create a new Data of pm table. Examples: - | pmt_uid_number | CAMPO2 | - | 1 | DEV1 | - | 2 | DEV2 | - | 3 | DEV3 | - | 4 | DEV4 | - | 5 | DEV5 | - | 6 | DEV6 | - | 7 | DEV7 | + | pmt_uid_number | + | 1 | + | 2 | + | 3 | + | 4 | + | 5 | + | 6 | + | 7 | + + +Scenario Outline: Update a a data of pm table + Given PUT this data: + """ + { + "UNO" : "UPDATE QA11", + "DOS" : "UPDATE QA22", + "TRES" : "UPDATE QA33" + } + """ + And that I want to update "PM Table" + And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | pmt_uid_number | + | 1 | + | 4 | + | 6 | + + +Scenario Outline: Get data of the PMTABLE + Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + 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 that "CAMPO1" is set to "QA" + And that "CAMPO2" is set to "CAMPO2" + + Examples: + + | pmt_uid_number | CAMPO2 | + | 1 | UPDATE QA11 | + | 4 | UPDATE QA22 | + | 6 | UPDATE QA33 | Scenario Outline: Update a pm table of a project @@ -189,55 +229,80 @@ Scenario Outline: Get a single the PMTABLE after update | 6 | UPDATESEIS | UPDATESEIS | VARCHAR | - -Scenario Outline: Update a a data of pm table - Given PUT this data: - """ - { - "UNO" : "", - "CAMPO1" : "QA", - "CAMPO2" : "" - } - """ - And that I want to update "PM Table" - And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - And the content type is "application/json" - Then the response status code should be 200 - And the response charset is "UTF-8" - - Examples: - - | pmt_uid_number | CAMPO2 | - | 1 | UPDATEQA2 | - | 4 | UPDATEQA4 | - | 6 | UPDATEQA6 | - - -Scenario Outline: Get data of the PMTABLE - Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - 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 that "CAMPO1" is set to "QA" - And that "CAMPO2" is set to "CAMPO2" - - Examples: - - | pmt_uid_number | CAMPO2 | - | 1 | UPDATEQA2 | - | 4 | UPDATEQA4 | - | 6 | UPDATEQA6 | - - Scenario: Get the PMTABLE List when there are exactly two pmtables in this workspace Given I request "pmtable" 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 "array" - And the response has 2 records + And the response has 8 records +#Test Delete of data + +Scenario Outline: Update a pm table of a project + Given PUT this data: + """ + { + "rep_tab_dsc" : "descripcion de la tabla", + "fields" : [ + { + "fld_key" : 1, + "fld_name" : "", + "fld_label" : "", + "fld_type" : "", + "fld_size" : 200 + } + ] + } + """ + And that I want to update a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | Description | pmt_uid_number | fld_name | fld_label | fld_type | + | Update a pmtable 1 | 4 | UPDATEUNO | UPDATEUNO | VARCHAR | + | Update a pmtable 3 | 5 | UPDATETRES | UPDATETRES | VARCHAR | + | Update a pmtable 6 | 7 | UPDATESEIS | UPDATESEIS | VARCHAR | + + +Scenario Outline: Get a single the PMTABLE after update + Given that I want to get a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + 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 that "fld_name" is set to "" + And that "fld_label" is set to "" + And that "fld_type" is set to "" + + Examples: + + | pmt_uid_number | fld_name | fld_label | fld_type | + | 4 | UPDATEUNO | UPDATEUNO | VARCHAR | + | 5 | UPDATETRES | UPDATETRES | VARCHAR | + | 7 | UPDATESEIS | UPDATESEIS | VARCHAR | + + +Scenario Outline: Get a single the PMTABLE after update + Given that I want to get a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + 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 has 0 records + + Examples: + + | pmt_uid_number | + | 4 | + | 5 | + | 7 | Scenario Outline: Delete a pm table of a pmtable Given that I want to delete a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" @@ -270,7 +335,7 @@ Scenario Outline: Delete a data of a pmtable Examples: | pmt_uid_number | - | 1 | + | 2 | Scenario: Get the PMTABLE List when there are exactly ONE pmtables in this workspace diff --git a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature index c787d165a..792a6f019 100644 --- a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature +++ b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature @@ -238,7 +238,6 @@ Scenario Outline: Route a case to the next task in the process Given PUT this data: """ { - "case_uid": "", "del_index": "1" } """ diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 8a0d75205..6242ae333 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1526,6 +1526,21 @@ class RestContext extends BehatContext $this->iRequest($url); + } + + /** + * @Given /^POST upload a project file "([^"]*)" to "([^"]*)"$/ + */ + public function postUploadAProjectFile($file, $url, PyStringNode $string) + { + $postFields = json_decode($string); + $postFields->project_file ='@'.$file; + + $this->_restObjectMethod = 'post'; + $this->_restObject = $postFields; + $this->iRequest($url); + + } From 0f4b04e145a3843d5bf4924297732241c32a603d Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 8 May 2014 09:47:39 -0400 Subject: [PATCH 2/3] Little fix when $output has not defined such as a normal terminal env like jenkins job execution. --- workflow/engine/bin/tasks/cliCommon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/bin/tasks/cliCommon.php b/workflow/engine/bin/tasks/cliCommon.php index 7cd0cd3f5..2e5653d2e 100755 --- a/workflow/engine/bin/tasks/cliCommon.php +++ b/workflow/engine/bin/tasks/cliCommon.php @@ -27,7 +27,7 @@ /* Get the size of the terminal (only works on Linux, on Windows it's always 80) */ preg_match_all("/rows.([0-9]+);.columns.([0-9]+);/", strtolower(exec('stty -a |grep columns')), $output); -if(sizeof($output) == 3) { +if(sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) { define("COLUMNS", $output[2][0]); } else { define("COLUMNS", 80); From 9facbabb0e92391f59f79072c9b1c98139cba3a7 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 8 May 2014 11:04:57 -0400 Subject: [PATCH 3/3] Adicion de nuevos features y arreglo en feature project --- .../negative_tests_project_resources.feature | 1 - .../main_tests_project_export.feature | 17 +++++++++++ .../main_tests_project_import.feature | 29 +++++++++++++++++++ .../negative_tests_project_export.feature | 0 .../negative_tests_project_import.feature | 0 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 features/backend/projects/project_export_import/main_tests_project_export.feature create mode 100644 features/backend/projects/project_export_import/main_tests_project_import.feature create mode 100644 features/backend/projects/project_export_import/negative_tests_project_export.feature create mode 100644 features/backend/projects/project_export_import/negative_tests_project_import.feature diff --git a/features/backend/projects/project/negative_tests_project_resources.feature b/features/backend/projects/project/negative_tests_project_resources.feature index c0afec2b0..69f909bb2 100644 --- a/features/backend/projects/project/negative_tests_project_resources.feature +++ b/features/backend/projects/project/negative_tests_project_resources.feature @@ -207,7 +207,6 @@ Scenario Outline: Create new Projects (Negative Tests) | Description | prj_name | prj_description | act_name | act_type | evn_name | evn_marker | error_code | error_message | | Field required prj_name | | Prueba | Task # 1 | TASK | End # 1 | EMPTY | 400 | prj_name | - | Field required prj_description | Test negative project 1 | | Task # 1 | TASK | End # 1 | EMPTY | 400 | prj_description | | Field required act_name | Test negative project 2 | Prueba 1 | | TASK | End # 1 | EMPTY | 400 | act_name | | Field required act_type | Test negative project 3 | Prueba 2 | Task # 1 | | End # 1 | EMPTY | 400 | act_type | | Field required evn_name | Test negative project 4 | Prueba 3 | Task # 1 | TASK | | EMPTY | 400 | evn_name | diff --git a/features/backend/projects/project_export_import/main_tests_project_export.feature b/features/backend/projects/project_export_import/main_tests_project_export.feature new file mode 100644 index 000000000..64bcf0aeb --- /dev/null +++ b/features/backend/projects/project_export_import/main_tests_project_export.feature @@ -0,0 +1,17 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Export Process Main Tests + Requirements: + a workspace with the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") already loaded + there are many activities, steps, triggers, pmtables, asignee, events, etc. in the process + +Background: + Given that I have a valid access_token + + +Scenario: Get for Export Project + Given I request "project/1455892245368ebeb11c1a5001393784/export" + 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 "array" + diff --git a/features/backend/projects/project_export_import/main_tests_project_import.feature b/features/backend/projects/project_export_import/main_tests_project_import.feature new file mode 100644 index 000000000..bd970e66b --- /dev/null +++ b/features/backend/projects/project_export_import/main_tests_project_import.feature @@ -0,0 +1,29 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Import Process Main Tests + Requirements: + a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") already loaded + there are many activities, steps, triggers, pmtables, asignee, events, etc. in the process + +Background: + Given that I have a valid access_token + + +Scenario: Get for Export Project + Given I request "project/1455892245368ebeb11c1a5001393784/export" + 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 "array" + + + Scenario Outline: Import a process + Given POST upload a project file "" to "project/import?option=" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + + + Examples: + | project_file | import_option | + | /home/wendy/processFiles/process1.pmx | create | \ No newline at end of file diff --git a/features/backend/projects/project_export_import/negative_tests_project_export.feature b/features/backend/projects/project_export_import/negative_tests_project_export.feature new file mode 100644 index 000000000..e69de29bb diff --git a/features/backend/projects/project_export_import/negative_tests_project_import.feature b/features/backend/projects/project_export_import/negative_tests_project_import.feature new file mode 100644 index 000000000..e69de29bb