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
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” ”
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:
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.
Jerome Josephraj is the Founder and CTO of NoCodeBDD. He has more than 20 years of experience in Software Development and have been rolling out Behavior Driven Development for large projects in United Kingdom. He has a strong Java Development Background and have been working as a Technical Consultant. In one of his recent large enterprise projects, he has successfully rolled out Behavior Driven Development consisting of more than 1000 scenarios. He was also the Founder of http://www.campusinteraction.com, a student analytics portal, which was later bought by Preludesys. Based on his previous start-up experience and a strong Behavior Driven Development experience, he founded NoCodeBDD to accelerate BDD automation by 10x.