Automating Behavior Driven Development (BDD) using NoCodeBDD is as easy as pie. Using NoCodeBDD to automate BDDs will take minutes rather than hours as there is no code involved in the automation. In this article, we will look at how NoCodeBDD can be used to call a REST API and how the response from that REST API is asserted.
As a first step, let’s write our Feature file. We will write a scenario to validate a REST response status and REST response message.
The scenario is self explanatory. One thing that might be worth explaining is, in the last step, we want to check entire message response from the API. Hence the reason for not passing values via the step. Passing values via the step is a simple process using NoCodeBDD, which is explained here https://wordpress.com/block-editor/post/nocodebdd.blog/21
Scenario 1: Call a REST API using GET and assert the status as 200 and message returned When NoCodeBDD User Info REST API is called using GET Then Response status should be 200 And Response from REST API should match all values as expected
Following GIF shows how the above Feature File is written in NoCodeBDD
Following sections show how the Feature file is automated without any code
Call REST API
For the Step “When NoCodeBDD User Info REST API is called using GET”, we need to call a REST API using GET HTTP method. In order to do that:
Click the burger menu next to the Step and then click on “Step Definitions”
Then click on “New Step Definition” button
Then select “REST” and click Next button
Then select “Send API Request” and click Next button
Then select Request Type as “GET” and enter the URL as “www.freeapi.nocodebdd.com/simpleGETAPI/userinfo” and press Save button
That’s it! You have completed automating a Step using NoCodeBDD. The above steps are shown as GIF below:
Assert REST API Response Status
For the Step “Then Response status should be 200”, we need to assert a REST response status. Following GIF shows how it is done.
Assert REST API Response Message
For the Step “And Response from REST API should match all values as expected”, we should assert the entire message to make sure it matches what is expected. This is shown in following GIF:
Congrats! You have automated a REST API using NoCodeBDD in minutes and without writing any code. Automation is of no usem if you can’t run. Following section shows how it is done through click of few buttons
Run your Automated BDD
Using NoCodeBDD, you can simply click the play button to run a Feature(s) or a Scenario. You can also view the request and response to the REST API. This is shown in following GIF.
If you would like to see what request and response messages are sent and received, you can simply click the i button and see the details. Following GIF shows how you can view the Request message that was sent in the step “When NoCodeBDD User Info REST API is called using GET”.
<Haritha – Show the GIF and highlight (in filmora you can do that) the request message>
Following GIF shows what response message was received <Haritha – Show the GIF and highlight (in filmora you can do that) the response message>
Finally, you can view the results of the Feature that you ran and any of the historical run stats by simply clicking the Report menu and select the one you would like to view as shown in GIF below:
As you can see, rolling out Behavior Driven Development and automating it is extremely easy using NoCodeBDD. The basic version of NoCodeBDD, allows you to create unlimited Features and Scenarios. You can download the version from www.nocodebdd.com/download
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 […]
Many websites now require two-factor authentication (2FA) as an extra security measure beyond a standard username and password. When a user enables 2FA for their account, they will receive a code (OTP) via their phone or email after successfully logging in with their username and password. This code must be […]
Following video shows how you could roll out BDD and automate UI applications without code through few clicks using NoCodeBDD For privacy reasons YouTube needs your permission to be loaded. For more details, please see our Footer.I Accept