From b0aa5d00ca2ac0ed3c487c9338c646bafce36700 Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Mon, 8 Dec 2014 09:56:04 -0400 Subject: [PATCH] =?UTF-8?q?Algunos=20Hooks=20ha=20sido=20adicionados=20par?= =?UTF-8?q?a=20evitar=20errores=20al=20ejecutar=20los=20behats=20de=20cone?= =?UTF-8?q?xi=C3=B3n=20a=20las=20base=20de=20datos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n_tests_database_connections_mysql.feature | 4 ++ ...sts_database_connections_sqlserver.feature | 4 ++ features/bootstrap/RestContext.php | 46 +++++++++++++++++++ 3 files changed, 54 insertions(+) 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 d4a7427c6..e1a016a65 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 @@ -25,6 +25,7 @@ Feature: DataBase Connections Main Tests Mysql # POST /api/1.0/{workspace}/project//database-connection/test # Test DataBase Connection + @MysqlDbConnection Scenario Outline: Test database connection to test Given POST this data: """ @@ -53,6 +54,7 @@ Feature: DataBase Connections Main Tests Mysql # POST /api/1.0/{workspace}/project//database-connection # Create new DataBase Connection + @MysqlDbConnection Scenario Outline: Create a new database connection Given database-connection with id "" is active And POST this data: @@ -98,6 +100,7 @@ Feature: DataBase Connections Main Tests Mysql # PUT /api/1.0/{workspace}/project//database-connection # Update a DataBase Connection + @MysqlDbConnection Scenario Outline: Update a database connection Given database-connection with id "" is active And PUT this data: @@ -127,6 +130,7 @@ Feature: DataBase Connections Main Tests Mysql # GET /api/1.0/{workspace}/project//database-connection # Get a single DataBase Connection and their properties + @MysqlDbConnection Scenario Outline: Get a single database connection and check some properties Given database-connection with id "" is active And that I want to get a resource with the key "dbs_uid" stored in session array as variable "dbs_uid_" 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 6081e43a7..2fb272877 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 @@ -25,6 +25,7 @@ Feature: DataBase Connections Main Tests SQL Server # POST /api/1.0/{workspace}/project//database-connection/test # Test DataBase Connection + @SqlServerDbConnection Scenario Outline: Test database connection to test Given POST this data: """ @@ -53,6 +54,7 @@ Feature: DataBase Connections Main Tests SQL Server # POST /api/1.0/{workspace}/project//database-connection # Create new DataBase Connection + @SqlServerDbConnection Scenario Outline: Create a new database connection Given database-connection with id "" is active And POST this data: @@ -98,6 +100,7 @@ Feature: DataBase Connections Main Tests SQL Server # PUT /api/1.0/{workspace}/project//database-connection # Update a DataBase Connection + @SqlServerDbConnection Scenario Outline: Update a database connection Given database-connection with id "" is active And PUT this data: @@ -127,6 +130,7 @@ Feature: DataBase Connections Main Tests SQL Server # GET /api/1.0/{workspace}/project//database-connection # Get a single DataBase Connection and their properties + @SqlServerDbConnection Scenario Outline: Get a single database connection and check some properties Given database-connection with id "" is active And that I want to get a resource with the key "dbs_uid" stored in session array as variable "dbs_uid_" diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 3dd903424..4c4407f52 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -87,6 +87,52 @@ class RestContext extends BehatContext } } + /** + * @BeforeScenario @MysqlDbConnection + */ + public function verifyAllRequiredDataToConnectMysqlDB() + { + $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'); + + 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 @SqlServerDbConnection + */ + public function verifyAllRequiredDataToConnectSqlServerDB() + { + $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!"); + } + } + } + /** * ============ json array =================== * @Given /^that I send (\[[^]]*\])$/