RestSharp: REST API testing using C# RestSharp and Json.NET - Part 2 | Framework

preview_player
Показать описание
RestSharp is a powerful library to automate REST API using C#. In this video I will explain about important part of RestSharp and how to automate your REST API tests. I have used NewtonSoft Json.NET to serialize and deserialize JSON.

Please download code from here

RestSharp C# Tutorial
RestSharp
API testing
WebServices Tutorial
Rest APIs
API Automation using C# RestSharp
Tests d'API REST à l'aide de C # RestSharp et Json.NET

REST API-testen met behulp van C # RestSharp en Json.NET

REST API testování pomocí C # RestSharp a Json.NET

REST-API-Tests mit C # RestSharp und Json.NET

Teste da API REST usando C # RestSharp e Json.NET

اختبار REST API باستخدام C # RestSharp و Json.NET

C # RestSharp ve Json.NET kullanarak REST API testing

#restsharp #csharp #net
Рекомендации по теме
Комментарии
Автор

Very useful videos. Some people are earning money by doing so and ask people to pay but on the hand people like you help the community. Really appreciate it. Thanks

romadeep
Автор

You are an Awesome teacher and I really appreciate you taking the time to do this. One thing I think you may have added for no reason is the Generic <T> on the ApiHelper<T> class. I removed it ( <T> ) on the class and the on the call to the constructor and it built and ran fine. I mention it because it confused me as to why you added it, so I had to prove it out. Again, thank you so much for doing this!
For instance, if class Demo<T> Were to really help with anything, we'd have to USE <T> inside the class.
For example, We could use it here:
var content = user.GetContent<T>(response);
But even this doesn't help us because the CreateUser method is returning a CreateUserDTO. We'd have to change that to return a dynamic type, and use var everywhere in the method instead of CreateUserDTO, and then this method would be truly Generic.
Example code:
In the Test file:
var demo = new RestDemo<CreateUserDTO>();
var user = demo.CreateUser("api/users", payload);
In Demo.cs:
public dynamic CreateUser(string endpoint, dynamic payload)
{
var user = new APIHelper<CreateUserDTO>();
var url = user.SetUrl(endpoint);
//var jsonReq = user.Serialize(payload); Serializing the payload caused an exception in GetContent?
var request =
var response = user.GetResponse(url, request);
var content = user.GetContent<T>(response);
return content;
}
Now this method will return the type that was passed when we instantiated it in the test file.

paulav
Автор

I am new to all these API, C# and Testing. Your Two videos helped me a lot!
Despite you mispelled "Verify" for 3 hours, it was a nice class!
Thank you so much for sharing.

hugo_alves
Автор

Excellent Explanation ! Please provide complete series

ChiragPatel-lkvl
Автор

Very nice. Enjoyed listening to the videos.

imoretull
Автор

Hello! Thanks for the videos!!!! So, how can I run my tests for different environments (DEV, QA etc) using your approach? I'd like to run the same tests in different pipelines.

allandomingues
Автор

Hello, This video is much helpful. I would like to know how can I post the payload with the values instead of hardcoding in the tests? Can you please provide me any sample?

MrsRajiniBalaji
Автор

Hello Sir, Great video..can you help how to validate the status code as your method returns only DTO type content. Suppose i want to perform assertion on response the how can i do it?

himanshu
Автор

Sir I'm facing an issue regarding multiple content count while debugging an automation script just after manual dry run using SoapUI.
In SoapUi I'm getting one member response for particular startdate & enddate. But while automating it on Visual Studio I'm getting result same as expected but while debugging it getting same content count 10 times.

Please resolve

adityatiwari
Автор

I like your demo but the other voice is bothering a lot. Is it possible to mute the other voice please.

padmaja