by Jerome Josephraj
Share
While automating Behavior Driven Development, automating Database operations and asserting Database Results is extremely easy using NoCodeBDD. All you have to do is, define your feature file using Gherkin language, add Database Connection, provide your SQL and define the values to Assert. Let’s look at how it is done step by step
Feature File
For the purpose of this blog, let’s assume the following Feature file
“When Database is called to check the User with userid as “U001” “
“Then the Firstname should have value “Joe” and Lastname should have value “Doe” ”
Step Definition
For the above Step, create a Step Definition and select “Run SQL Query” option, before asserting DB results, we need to provide the DB SQL to get the result. Following sections show how it is done
Create DB Connection
In DB connection page, select a connection before you add a SQL. Adding a connection is straight forward. The connection configuration is similar to any DB client. All you need to do is provide a connection name, which can be any name. The DB server host name or IP, Database name, Database Type, Port number and Username and Password. If Password is not required, leave it empty. Following GIF shows how a DB connection is added:
Add SQL without writing any code
Once a Database Connection is added, provide a SQL as shown in GIF below
Assert SQL values without writing any code
Once you have defined your DB connection and provided the SQL to fetch the results, you can assert by selecting “Assert SQL Response” and select Single Row, which is selected by default. Then enter the column name that needs to be asserted that’s “Firstname” and the value as “Joe”. Add another row and enter column name as “Lastname” and value as “Doe” and press Save. This is shown in GIF below:
Check Results
To check the results, simply press Run and press play button. This will run the added Step Definitions and you can view the details by pressing “i” button next to step. This is shown in the GIF below:
The above shows how easy it is to validate DB results using NoCodeBDD, without having to write any code. Most importantly, there is no code to maintain. NoCodeBDD, basic version, is free to use. Feel free to download it from www.nocodebdd.com/download and automate your BDDs in minutes.
STAY IN THE LOOP
Subscribe to our free newsletter.
I had the pleasure of hosting a webinar with two industry experts, Rebecca Stone from IBM. During the webinar, Rebecca shared her experience in successfully implementing BDD in a large government project, highlighting the benefits of BDD, why and how she used OOPSI and its role in overcoming challenges faced […]
Rolling out BDD in a project requires careful planning and a well-structured process. As a tech consultant on a large project, I had to make several changes to their BDD process and automation suite implementation. Some changes were straightforward, while others proved more challenging. If you’re considering implementing BDD in […]
10 Tips for Writing Effective BDD Scenarios When rolling out BDD having a clear and concise scenario writing is a vital aspect of successful BDD adoption. This blog post will provide you with 10 tips to enhance your BDD scenario writing, making it easy to understand, maintainable, and efficient. 1. […]
It will be difficult to automate testing if you don’t consider it when creating your web application. It will be difficult, regardless of whether you are a code wizard or a no-code ninja. Here are some crucial ideas to have in mind as you develop your app to make testing a […]