From 6e6a899acf27752ab2f1703bf5d412909bbdd38a Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Tue, 9 Dec 2014 10:43:39 -0400 Subject: [PATCH] Some adjustments were added in order to resolve the input data in features related to database connections. --- behat.yml.dist | 4 +- ...n_tests_database_connections_mysql.feature | 36 +++++++++-------- ...sts_database_connections_sqlserver.feature | 35 +++++++++-------- ...egative_tests_database_connections.feature | 4 +- features/bootstrap/RestContext.php | 39 ++++++++++++++++++- 5 files changed, 78 insertions(+), 40 deletions(-) diff --git a/behat.yml.dist b/behat.yml.dist index 3c42f2ff9..f70f887da 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -8,9 +8,9 @@ default: client_secret: 179ad45c6ce2cb97cf1029e212046e81 #uploadFilesFolder: /opt/uploadfiles #cd5cff9b2e3ebabf49e276e47e977fab5988c00e - login_url: http://processmaker-ip-or-domaint/sys[workspace]/en/neoclassic/login/login + login_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/login/login authentication_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/login/authentication.php - oauth_app_url: http://processmaker-ip-or-domaint/sys[workspace]/en/neoclassic/oauth2/clientSetupAjax + oauth_app_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/oauth2/clientSetupAjax oauth_authorization_url: http://processmaker-ip-or-domain/[workspace]/oauth2/authorize user_name: user_password: diff --git a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature index e1a016a65..992dc54f1 100644 --- a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature +++ b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature @@ -5,11 +5,13 @@ Feature: DataBase Connections Main Tests Mysql and workspace with the project 87648819953a85c0abc01d3080475981 ("testExecutionOfDerivationScreen") already loaded there are zero Database Connections in the processes. + # MySQL is tagged like 1 Background: Given that I have a valid access_token + And database tagged like 1 -# GET /api/1.0/{workspace}/project//database-connections + # GET /api/1.0/{workspace}/project//database-connections # Get list DataBase| dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | Connections Scenario Outline: Get the DataBase Connections List when there are exactly zero DataBase Connections Given I request "project//database-connections" @@ -19,8 +21,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | record | - | 106912358530c9b14ac15d3001790900 | 0 | - | 1265557095225ff5c688f46031700471 | 0 | + | 74737540052e1641ab88249082085472 | 0 | + | 87648819953a85c0abc01d3080475981 | 0 | # POST /api/1.0/{workspace}/project//database-connection/test @@ -48,8 +50,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # POST /api/1.0/{workspace}/project//database-connection @@ -79,8 +81,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -94,8 +96,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | 1 | - | 1265557095225ff5c688f46031700471 | 1 | 2 | + | 74737540052e1641ab88249082085472 | 1 | 1 | + | 87648819953a85c0abc01d3080475981 | 1 | 2 | # PUT /api/1.0/{workspace}/project//database-connection @@ -124,8 +126,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -149,8 +151,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # DELETE /api/1.0/{workspace}/project//database-connection @@ -165,8 +167,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | - | 1265557095225ff5c688f46031700471 | 2 | + | 74737540052e1641ab88249082085472 | 1 | + | 87648819953a85c0abc01d3080475981 | 2 | # GET /api/1.0/{workspace}/project//database-connection @@ -180,5 +182,5 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 0 | 1 | - | 1265557095225ff5c688f46031700471 | 0 | 2 | \ No newline at end of file + | 74737540052e1641ab88249082085472 | 0 | 1 | + | 87648819953a85c0abc01d3080475981 | 0 | 2 | \ No newline at end of file diff --git a/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature b/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature index 2fb272877..4b69b9d90 100644 --- a/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature +++ b/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature @@ -5,9 +5,10 @@ Feature: DataBase Connections Main Tests SQL Server and workspace with the project 87648819953a85c0abc01d3080475981 ("testExecutionOfDerivationScreen") already loaded there are zero Database Connections in the processes. + # Microsoft SQL Server is tagged like 2 Background: Given that I have a valid access_token - + And database tagged like 2 # GET /api/1.0/{workspace}/project//database-connections # Get list DataBase Connections @@ -19,8 +20,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | record | - | 106912358530c9b14ac15d3001790900 | 0 | - | 1265557095225ff5c688f46031700471 | 0 | + | 74737540052e1641ab88249082085472 | 0 | + | 87648819953a85c0abc01d3080475981 | 0 | # POST /api/1.0/{workspace}/project//database-connection/test @@ -48,8 +49,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # POST /api/1.0/{workspace}/project//database-connection @@ -79,8 +80,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -94,8 +95,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | 1 | - | 1265557095225ff5c688f46031700471 | 1 | 2 | + | 74737540052e1641ab88249082085472 | 1 | 1 | + | 87648819953a85c0abc01d3080475981 | 1 | 2 | # PUT /api/1.0/{workspace}/project//database-connection @@ -124,8 +125,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -149,8 +150,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # DELETE /api/1.0/{workspace}/project//database-connection @@ -165,8 +166,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | - | 1265557095225ff5c688f46031700471 | 2 | + | 74737540052e1641ab88249082085472 | 1 | + | 87648819953a85c0abc01d3080475981 | 2 | # GET /api/1.0/{workspace}/project//database-connection @@ -180,5 +181,5 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 0 | 1 | - | 1265557095225ff5c688f46031700471 | 0 | 2 | \ No newline at end of file + | 74737540052e1641ab88249082085472 | 0 | 1 | + | 87648819953a85c0abc01d3080475981 | 0 | 2 | \ No newline at end of file diff --git a/features/backend/projects/database_connections/negative_tests_database_connections.feature b/features/backend/projects/database_connections/negative_tests_database_connections.feature index fe76867bd..e4beb0773 100644 --- a/features/backend/projects/database_connections/negative_tests_database_connections.feature +++ b/features/backend/projects/database_connections/negative_tests_database_connections.feature @@ -51,5 +51,5 @@ Feature: DataBase Connections Negative Tests Examples: | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | | | | | | | | | - | | | | | | | | | \ No newline at end of file + | | | | | | 33O6 | | | + | | | | | | 33O6 | | | \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 4c4407f52..c81f12b34 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -87,6 +87,42 @@ class RestContext extends BehatContext } } + /** + * @BeforeScenario @DbConnection + */ + public function verifyAllRequiredDataToConnectDB($db_type) + { + $db_parameters = null; + if ($db_type === 1){ + $db_parameters = array( + 'mys_db_type', + 'mys_db_server', + 'mys_db_name', + 'mys_db_username', + 'mys_db_password', + 'mys_db_port', + 'mys_db_encode', + 'mys_db_description'); + }elseif($db_type === 2){ + $db_parameters = array( + 'sqlsrv_db_type', + 'sqlsrv_db_server', + 'sqlsrv_db_name', + 'sqlsrv_db_username', + 'sqlsrv_db_password', + 'sqlsrv_db_port', + 'sqlsrv_db_encode', + 'sqlsrv_db_description'); + } + + foreach ($db_parameters as $value) { + $param = $this->getParameter($value); + if (!isset($param)){ + throw new PendingException("Parameter ".$value." is not defined or is empty, please review behat.yml file!"); + } + } + } + /** * @BeforeScenario @MysqlDbConnection */ @@ -1725,7 +1761,7 @@ class RestContext extends BehatContext /** * @Given /^that "([^"]*)" property in object "([^"]*)" equals "([^"]*)"$/ */ - public function thatPropertyInObjectEquals($propertyName, $propertyParent, $value) + public function thatPropertyInObjectEquals($propertyName, $propertyParent, $propertyValue) { $data = $this->_data; if (empty($data)) { @@ -1899,7 +1935,6 @@ class RestContext extends BehatContext $sessionData = new StdClass(); } - $sessionData = new StdClass(); if(!$sessionData->dbconnectionStatus->$dbConnectionId){ throw new PendingException("Skip inactive dbconnection: $dbConnectionId"); }