Writing Your First Test
This section will describe how to configure Bard in order to write your first API test. This example demonstrates the simplest way to use Bard and does not use the more advanced StoryBook feature which we will cover in more detail in this section of the documentation.
Configure The Scenario
So before we can start we need to configure our Scenario. To do this we are going to need provide two things.
A
System.Net.Http.HttpClient
in order to call our APIA function to tell our Scenario how to log. This is optional but important because Bard provides detailed logs to the test output windows to help with writing and debugging test failures. If not supplied Bard will ouput all log messages to the Console window which may not appear in your test output.
The GitHub repository has some example tests you can see a working example here.
Write The First Test
We've configured our Scenario now. Assuming our API is running now we can start by calling it.
So lets give it a spin by writing a test that calls our fictitious Banking API and creating a new bank account. We expect our API to return a 201 Created response.
And we're done. If we look at the output from our Test we should see some nice logging that includes the request and the response.
Last updated