Human Readable Tests

Significantly improve your test’s readability by working with C# objects. BELLATRIX can also generate test cases that are understandable for non-technical people.

10+ Supported Request Types

Request types which you can use directly with C# instead of working with JSON and XML.

Testing APIs can get quite complicated and unreadable if we keep lots of JSON and XML in our tests. BELLATRIX comes with 10 default request types which you can use directly with C# objects instead of JSON or XML. Moreover, the BELLATRIX API testing syntax makes reading and understanding the tests easier.
Making GET request and return a C# response object.

var request = new RestRequest("api/Albums/10");
var response = _apiClientService.Get<Albums>(request);

Change the title and create a PUT request.

var putRequest = new RestRequest("api/Albums/11");
getResponse.Data.Title = Guid.NewGuid().ToString();
putRequest.AddJsonBody(getResponse.Data);
_apiClientService.Put<Albums>(putRequest);

Create a new album. Create a POST request and add the new object as a JSON body.

var newAlbum = CreateUniqueGeneres();
var request = new RestRequest("api/Genres");
request.AddJsonBody(newAlbum);
var response = _apiClientService.Post(request);

Delete an existing artist.

var deleteRequest = new RestRequest($"api/Artists/{newArtist.ArtistId}");
var response = _apiClientService.Delete(deleteRequest);

All BELLATRIX client API methods have an async version. Your test should be marked as async and you should use the await operator.

var deleteRequest = new RestRequest($"api/Artists/{newArtist.ArtistId}");
var response = await _apiClientService.DeleteAsync<Artists>(deleteRequest);

Learn more

Responses as C# Objects

Automatically convert any XML or JSON response to a predefined C# object.

Making requests is not enough to test APIs. You also need to make validations of the responses. They are returned natively as JSON or XML. Some test frameworks are hard to use or read because they tend to use JSON and XML directly. The tests are polluted with low-level logic for converting text to language types such as boolean or numbers.

RestAssured Example Java

given().when().get("/garage").then()
       .body("name",equalTo("Acme garage"))
       .body("info.slots",equalTo(150))
       .body("info.status",equalTo("open"))
       .statusCode(200);

The problem is that if the fields like “name”, “info.slots” or “info.status” change, your tests will start to fail. Moreover, you have to hard-code these values in each test and know them beforehand.

To solve these problems, BELLATRIX automatically converts any XML or JSON response to a predefined C# object. If there is a change in the response schema, you will see a meaningful error explanation and need to fix everything in one place.

BELLATRIX Example

var getUpdatedResponse = _apiClientService.Get<Albums>(request);
Assert.AreEqual(updatedTitle, getUpdatedResponse.Data.Title);

After the GET request, you can directly work with the Albums object. Of course, you can still access the original XML or JSON response body. The tests readability is further improved when you need to create or update objects. Instead of building yourself the JSON or all of the fields, you can do it directly by initializing the C# object.

RestAssured Example Java

JSONObject requestParams = new JSONObject();
requestParams.put("AlbumId", 23);
requestParams.put("Title", "Open Your Eyes");
requestParams.put("ArtistId", 26);
requestParams.put("ArtistName", "Guano Apes");
requestParams.put("AlbumName",  "Proud Like a God");
request.body(requestParams.toJSONString());
Response response = request.post("api/Albums");

BELLATRIX Example

var newAlbum = new Albums
{ 
    Artist = guanoApesArtist,
    Title = "Open Your Eyes",
    Tracks = new List<Tracks>() { openYourEyesTrack },
};
var postRequest = new RestRequest("api/Albums");
postRequest.AddBody(newAlbum);
var response = _apiClientService.Get<Albums>(request);

We work with C# objects and there are no hard-coded, copy-pasted strings.
Learn more

BDD Logging

There are cases when you need to show your colleagues or managers what tests you have. Sometimes you may have manual test cases, but their maintenance and up-to-date state are questionable.

BELLATRIX generates automatically these test cases for you. This is a sample test case log generated after test execution


Start Test
Class = BDDLoggingTests Name = PurchaseRocketWithLogs
Select 'Sort by price: low to high' on CartPage 
Click ApplyCupon on CartPage 
Ensure SuccessDiv on CartPage inner text is 'Coupon code applied successfully.'
Set '0' into QuantityNumber on CartPage 
Click UpdateCartButton on CartPage 
Ensure OrderTotalSpan on CartPage inner text is '95.00€'

Learn more

Try Now Bellatrix

Build up to 100 tests using full product capabilities.

Download