basdijkstra / rest-assured-net

C# DSL for writing readable tests for HTTP-based APIs
Apache License 2.0
145 stars 19 forks source link

Feature: Please add functionality to return just the response time or functionality to compare the response time to a TimeSpan #91

Closed christiaanwvermaak closed 1 year ago

christiaanwvermaak commented 1 year ago

As part of SLA for responses, one should be able to specify the maximum amount of time, in milliseconds or seconds, for a response and then you should be able to validate if it is within the response time specified by the SLA. Alternatively, just provide a method to return just the response time so that one can do an assert in the code.

basdijkstra commented 1 year ago

Thank you for submitting the feature request, @christiaanwvermaak. As discussed via WhatsApp, this shouldn't be too hard to implement. I think I'll add both an option to verify the response time (using NHamcrest matchers) and to extract it for use in a custom assertion (or logging, or whatever).

basdijkstra commented 1 year ago

Added ability to extract the response time as a TimeSpan in https://github.com/basdijkstra/rest-assured-net/commit/ad68705632c2cace69e4ddedfb7eb157e9abb9bb

basdijkstra commented 1 year ago

Both features are available in 3.0.0-beta.2, could you please test them and close this issue if all works as expected, @christiaanwvermaak ?

christiaanwvermaak commented 1 year ago

Both of the ways proposed to implement this is working correctly.