Skip to content

Commit

Permalink
Removed unnecessary references to @Sql tag
Browse files Browse the repository at this point in the history
  • Loading branch information
josefd8 committed Jul 9, 2022
1 parent 44dc08e commit 1031445
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ _[Testing Rest services](https://veepee-oss.github.io/gingerspec/steps-for-testi

_[Testing a web page](https://veepee-oss.github.io/gingerspec/steps-for-testing-web-pages.html)_
```
@web
Scenario: Fill the form and click the submit button
Given I go to 'http://demoqa.com/text-box'
And I type 'John' on the element with 'id:userName'
Expand All @@ -189,7 +190,6 @@ _[Testing a web page](https://veepee-oss.github.io/gingerspec/steps-for-testing-

_[Testing database](https://veepee-oss.github.io/gingerspec/steps-for-testing-relational-databases.html)_
```
@sql
Scenario: Executing SELECT statements on a MySQL database
Given I connect with JDBC to database 'mysql' type 'mysql' on host '${MYSQL_HOST}' and port '3306' with user 'root' and password 'mysql'
Then I execute query 'CREATE TABLE IF NOT EXISTS weather1 (city varchar(80), temp_lo int, temp_hi int, prcp real, date date);'
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/privalia/qa/specs/SqlDatabaseGSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public SqlDatabaseGSpec(CommonG spec) {
* <p>
* The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.
* All subsequent steps that interact with the database will be performed on this connection. You can also use the
* step {@link #disconnectDatabase()} to close this connection at the end of your scenarios, however, it is recommended
* to include the @sql tag in your scenarios to allow gingerspec to do this automatically. The current supported types of
* step {@link #disconnectDatabase()} to close this connection at the end of your scenarios. The current supported types of
* databases are postgresql/mysql
* <pre>{@code
* Example:
Expand Down Expand Up @@ -104,8 +103,7 @@ public void connectDatabase(String isSecured, String database, String dataBaseTy
* Close the Database connection
* <p>
* Closes the active database connection. To create a database connection use the step {@link #connectDatabase(String, String, String, String, String, String, String)}
* You can use this step to close the database connection at the end of your scenarios, however, it is recommended to include
* the @sql tag in your scenarios to allow gingerspec to do this automatically.
* You can use this step to close the database connection at the end of your scenarios.
* <pre>{@code
* Example:
*
Expand Down
8 changes: 3 additions & 5 deletions src/test/resources/features/sqlDatabaseSteps.feature
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
Feature: Steps for testing relational databases

Steps related to working with SQL relational databases (currently supports postgresql and mysql). In Scenarios that create connections
to a database, you can also use the @sql tag to automatically close any open sql connection after the Scenario completes, so is not necessary to
use the step "Then I close database connection" at the end.
Steps related to working with SQL relational databases (currently supports postgresql and mysql). GingerSpec automatically
detects if a database connection was left open at the end of each scenario and automatically tries to close it, so is not
necessary to use the step "Then I close database connection" at the end.

For more information check out:
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-tags#sql-tag

Rule: Opening and closing a connection to a database

Expand Down

0 comments on commit 1031445

Please sign in to comment.