This is a migrated thread and some comments may be shown as answers.

Web API testing in Test studio

23 Answers 171 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
SURAJ
Top achievements
Rank 1
SURAJ asked on 05 Jun 2014, 08:04 AM
Please any one help me out on Web API testing. How we can do the Web API testing in telerik test studio? or there is another way please suggest.

23 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 09 Jun 2014, 09:28 PM
Hello SURAJ,

Before I say whether or not Test Studio can help you what does "Web API testing" mean to you? What exactly are you trying to test? Are you planning to make HTTP calls to verify a web service is functioning? Or are you planning to make API calls directly? How do you want to make these calls? What results will you want to verify and how do you want to verify them?

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
SURAJ
Top achievements
Rank 1
answered on 10 Jun 2014, 04:50 AM
In our project we use REST web API's. Currently I just want check GET and POST call responses by calling those REST API directly and depends on response receive I am going to do Asserts. So please suggest me the solution how I can accomplish it  in Telerik test studio or what will be the better framework I can use?
0
Cody
Telerik team
answered on 12 Jun 2014, 09:24 PM
Hi SURAJ,

Thank you for the clarification. I don't think Test Studio, our full IDE is going to be the right solution for you. Test Studio was designed to do UI automation, to drive a browser window, or WPF application, as if a real person were sitting there interacting with it directly. It does this through UI automation. We don't have built-in method for making direct GET and POST call's and validating the responses.

If it were me I'd use either our free framework or create a Microsoft coded unit test to do this. Either way you'll need to write your own code for making the GET and POST call's and validating the responses.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Timothy
Top achievements
Rank 2
answered on 15 May 2015, 11:32 PM

Found this post by searching "API Testing" and thought I would reply for posterity's sake. 

Check out my code sample and see if that helps. 

http://www.telerik.com/support/code-library/testing-rest-api-using-test-studio

0
Pravallika
Top achievements
Rank 1
answered on 09 Jun 2015, 06:15 PM

Hi,

 I use the following code in my project for Rest GET and POST calls. Hope this works for you too! :)

 

GET METHOD:

public String get(String restURL, Boolean AuthFlag, string UserName, string password)
        {
            Manager.Current.Log.WriteLine("*********** RESTURL**********" + restURL);
            var request = WebRequest.Create(restURL);
            request.Method = "GET";
            request.ContentType = "application/json";
            var networkCredential = new NetworkCredential(UserName, password);
            request.Credentials = networkCredential;
            string responsetext = null;

            try
            {
                using (var response = request.GetResponse())
                {
                    Debug.WriteLine(((HttpWebResponse)response).StatusDescription);

                    var receiveStream = response.GetResponseStream();
                    var readStream = new StreamReader(receiveStream, Encoding.UTF8);

                    Manager.Current.Log.WriteLine("Response stream received.");
                    responsetext = readStream.ReadToEnd();
                    Manager.Current.Log.WriteLine(responsetext);
                    response.Close();
                    readStream.Close();
                    return responsetext;
                }
            }
            catch (Exception e1)
            {
                Manager.Current.Log.WriteLine(e1.Message);
                                Manager.Current.Log.WriteLine(responsetext);
            }

            return responsetext;
        }

POST METHOD:

public string Post(string restURL, Boolean AuthFlag, string payload, string UserName, string password)
        {
            Manager.Current.Log.WriteLine("****** restUrl *****" + restURL);
            Manager.Current.Log.WriteLine("****** payload *****" + payload);
            var request = WebRequest.Create(restURL);
            request.Method = "POST";
            var postData = payload;
            var byteArray = Encoding.UTF8.GetBytes(postData);
            request.ContentType = "application/json";
            var networkCredential = new NetworkCredential(UserName, password);
            request.Credentials = networkCredential;
            var dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();
            var response = request.GetResponse();
            Debug.WriteLine(((HttpWebResponse)response).StatusDescription);
            dataStream = response.GetResponseStream();
            var reader = new StreamReader(dataStream);
            var responseFromServer = reader.ReadToEnd();
            Manager.Current.Log.WriteLine(responseFromServer);
            reader.Close();
            dataStream.Close();
            response.Close();
            return responseFromServer;
        }

0
Boyan Boev
Telerik team
answered on 12 Jun 2015, 08:09 AM
Hello Pravallika,

Thank you for sharing your knowledge with our community.

We really appreciate it!

Thank you again!

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Max
Top achievements
Rank 1
answered on 15 Mar 2016, 04:32 AM

Hi Pravallika/Boyan/TIM,

I found this post while searching in the net how to test the Web API for my project through Telerik Test Studio. I am using Telerik Test Studio for Functional testing. How I can use this code and where I need to write this to do my testing. I have never used the coding while doing the testing. I am using only recording. Could you please guide me how to incorporate the coding part.I would really appreciate for your help.

Thanks, 

Satya

0
Boyan Boev
Telerik team
answered on 17 Mar 2016, 11:53 AM
Hello Satyanarayan,

Thank you for contacting us.

This is some custom implementation which we do not support. 

@Pravalika could you please give us some information about your approach.

@Satyanarayan we will introduce API Testing as part of Test Studio during the next releases this year and it will be officially supported.

Hope that helps.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
akhila
Top achievements
Rank 1
answered on 12 Apr 2016, 07:18 PM

can we use telerik for API testing. Please let me know is it possible or not.

 

Thanks

0
Boyan Boev
Telerik team
answered on 15 Apr 2016, 10:34 AM
Hi Akhila,

We are now implementing this functionality in Test Studio.

It is expected to go live in June this year.

Hope that helps.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Vivek
Top achievements
Rank 1
answered on 11 May 2016, 07:52 AM

Hi

I want to automate my APIs like i want to test my API request and responses using Test Studio. But  i am not able to get the option to do the same. So please let me know if API funtional automation testing is possible using Test Studio.

Thanks

0
Boyan Boev
Telerik team
answered on 11 May 2016, 03:11 PM
Hello,

This functionality will be available in Test Studio in June this year.

We are now implementing it.

Thank you for your understandings. 

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Missing User
answered on 02 Jun 2016, 08:51 PM

Hi Boyan, 

Do you have a release date of when the API testing part will be released?
Will it be a fully working api testing functionality or limited and you will continue to improve and add new features?

kind regards,

0
Govind
Top achievements
Rank 1
answered on 07 Jun 2016, 02:01 AM

Hi Suraj,

You can automate Web API testing using RESTSHARP & NewtonSoft. There are very simple http calls that you need to make and easy to code. I have attached a sample of what we have done on our project.

If you don't have Visual Studio, the the latest version of Test Studio can be used for your automation. You need to take help from your developers in understanding on how to make calls and create POCO.

In my case, i have stored all the data in an excel spread sheet, parse the sheet, use NewtonSoft to serialize and Deserialize the objects (POCO). I also store all the JSONs for completeness and correctness.

 

Hope this helps, have attached a sample. You need to include the libraries for restsharp & newtonsoft.

 

You may use Telerik Fiddler which can also be used to automate WebAPI. This is more simple, there is an article on Telerik site

http://www.telerik.com/blogs/api-testing-with-telerik-fiddler

cheers

govind

0
Boyan Boev
Telerik team
answered on 07 Jun 2016, 12:41 PM
Hi Pitt,

The release which includes the API testing is expected at the end of this month.

This will be a complete API testing solution, which of course will be improved with a lot of new features in the feature release. We are constantly improving our products.

Thank you!

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Govind
Top achievements
Rank 1
answered on 08 Jun 2016, 12:45 AM

Hello Suraj,

You can try using RestSharp & NewtonSoft, they are simple to use. Your developer should be able to set this up for you in quick time.

Unfortunately the admin on telerik removed my last post.

regards

govind

0
Boyan Boev
Telerik team
answered on 09 Jun 2016, 07:50 AM
Hello Govind,

You post is not removed, it is right above mine. We do not remove any post from our customers especially when it is a knowledge sharing.

Thank you for sharing your knowledge with the community.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Jyoti
Top achievements
Rank 1
answered on 07 Oct 2016, 09:37 AM

Telerik Team,
From past few weeks am working on your tool: Test Studio for APIs, there are so many things which are not clear in your document guide and webinar demo. This tool is new for me in terms of API testing. I would really appreciate if I can get some solutions on my following queries from your team with respect to this tool:

1. Does Telerik Test Studio for APIs supports Web API testing?
2. How do I pass the Web API URL to perform some GET and POST methods? (Should I simply add it as a base-url under Project?).
3. While accessing some sample APIs like Google Maps (geocode) or Youtube API, it shows an Proxy Authorization issue status i.e. 407. This is blocking me from exploring the tool and its features.
4. Your built-in demo application has no clear definition as to how it is connected with the tool. If I want to connect such .exe or console application with the tool, how should I proceed?

Kindly help me with some solution as my organization is looking forward to use Test Studio API tool for future API projects.

0
Elena
Telerik team
answered on 12 Oct 2016, 08:55 AM
Hi Jyoti,

Here are my comments on your topics: 
1. Test Studio for APIs supports any REST service so if you mean testing a REST service based on ASP.Net Web Api you should be able to test it. 
2. You can add it directly as a url, or you can create a project or test-level variable.
3. Probably your APIs need some kind of authorization. Based on the type of authorization, in most cases you can use an Authorization header with an access token to perform the authorized request. This is specific and you need to research what kind of authorization these APIs require. 
4. The demo application is designed to send requests against it for testing purposes. Here is an article for the demo project in Test Studio for APIs. 

I hope this information will be helpful to you. 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Jyoti
Top achievements
Rank 1
answered on 12 Oct 2016, 11:41 AM

Hi Elena,

Thank-you for helping me out, your comments have solved most of my queries.

Regards,

Jyoti Shanbal

0
Elena
Telerik team
answered on 14 Oct 2016, 12:58 PM
Hi Jyoti,

I am glad to hear the shared information was helpful to you. Feel free to contact Test Studio Support Team in case of any further queries. 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
subhash
Top achievements
Rank 1
answered on 11 Jul 2019, 12:39 PM
I need to parameterize the requests and need to verify the different data in each request
Could you please advice on this scenario.
Thanks
Subhash
0
Elena
Telerik team
answered on 16 Jul 2019, 10:27 AM
Hi Subhash,

Recently you have started another public thread on the same topic and since the discussion there is already in progress, I will proceed closing the current conversation as a duplicate one. 

Thank you for your understanding in advance. 

Regards,
Elena Tsvetkova
Progress Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
SURAJ
Top achievements
Rank 1
Answers by
Cody
Telerik team
SURAJ
Top achievements
Rank 1
Timothy
Top achievements
Rank 2
Pravallika
Top achievements
Rank 1
Boyan Boev
Telerik team
Max
Top achievements
Rank 1
akhila
Top achievements
Rank 1
Vivek
Top achievements
Rank 1
Missing User
Govind
Top achievements
Rank 1
Jyoti
Top achievements
Rank 1
Elena
Telerik team
subhash
Top achievements
Rank 1
Share this question
or