Categories: Uncategorized

by Jerome Josephraj

Share

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.

For the purpose of this article we will be using the following API:
https://nocodebdd-apis.uc.r.appspot.com/simpleGET/userinfo

Write your Feature File

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>

View Reports

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

STAY IN THE LOOP

Subscribe to our free newsletter.

Related Posts

View all

  • 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 […]

    Continue reading
  • Key Considerations for Rolling Out BDD in a Project Key Considerations for Rolling Out BDD in a Project

    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 […]

    Continue reading
  • 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. […]

    Continue reading
  • 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 […]

    Continue reading