Hot answers tagged

18

How you approach testing an API depends on a lot of things. Will the API be a public API that will be consumed by some external people/systems, or is it a part of a larger product's infrastructure? API is a general term that is sometimes used to describe anything from a COM interface, to a DLL or JAR you can reference, to a REST web service. Different ...


10

I have had exactly the same assignment earlier this year, for APIs written in C#. Options I have (tried to) build a PoC for were: SoapUI Postman Own framework built in C# using either RestSharp or HttpClient. In agreement with the test lead and architecture team, we have decide to use our own C# API testing framework for the following reasons: Ease of ...


9

API Test Checklist API Endpoints Status Codes Payload Data Performance Security Specifically What documentation exists ? What functionality it provide ? Does it support concurrency ? What are the API endpoints ? Is the API internal or external ? Which endpoints are idempotent ? Are endpoints stateless or stateful ? Do any ...


6

You can use the combination of any unit testing framework (like NUnit, MSTest, XUnit) with additional nuget packages for the work with REST API itself RestSharp (http://restsharp.org/) Probably the most popular and convenient REST HTTP Client for .Net. RestAssured.Net (https://github.com/lamchakchan/RestAssured.Net) .Net port of Java's lib, may be easier ...


5

Choosing the tool is not the only decision you need to make when testing an API. As for any testing task you need to decide: What aspects of the program are you testing? What application features do you want to cover with API testing? Are you going to verify some stateful scenarios (e.g. when user is logged in)? Or maybe you want to verify how an API ...


4

In general I think you should not expect a mocked front-end that's hooked up to the API calls for testing (however if you have one lucky you!). Instead, API functions are generally tested with unit and integration tests. You'll need visibility into the API function calls themselves, so the testing will be white-box or at least grey-box. You should be ...


4

REST-Assured is one good option. I have used it with Java. It's a really good option and gives you the flexibility to do a lot when it comes to API testing. Refer to the below link for further details related to using Rest-Assured. using REST-Assured


4

Writing an API test in Visual Studio can be done with: NUnit or MSTest as your Test Runner ** NUnit and the TestAdapter are available on Nuget An http client, like .Net's HttpClient ** This is in the System.Net namespace (Optional) Json.Net for parsing responses ** Also avaiable on Nuget Your test will look something like this: [Test] public void ...


4

You need to provide token generated create Token API here in header under cookie field. and URL used in not as mentioned in API https://restful-booker.herokuapp.com/booking/{bookingID} Please check the screenshot here.


4

I would approach with just refactoring the code to use restLibTwo. Here are few points on why I would do that: Rest calls are just HTTP calls. Moving to another lib (for example RestAssured) would be likely motivated by surrounding functionality (like using gherkin notation or integrated json/xml parsing). So usually nobody tests REST with the lib that just ...


3

Start from learning REST API testing. REST is just an architectural paradigm, however most often it is implemented over HTTP protocol. So if you mean such the REST API then I would recommend to learn: Some programming language basics Learn how to interact with remote services using HTTP(s) protocols in that chosen programming language Select some service to ...


3

You can take a look at Google HTTP Client Library for Java, that offers: Pluggable HTTP transport abstraction that allows you to use any low-level library such as java.net.HttpURLConnection, Apache HTTP Client, or URL Fetch on Google App Engine. You would need to write your own binding between Google HTTP Client API and restLibTwo. Note, however, there ...


3

I generally agree with @alexey-r... You should probably just re-write the code when the library changes. Companies change libraries for a reason; new features, better features, streamlined configuration, etc. If you try to abstract too much you are: Building your own API to connect with someone else's API Making it difficult to take advantage of the ...


2

Single Sign-On is a very broad term and testing it will much depend on how it has been actually implemented in your project. In short Single Sign-On provides you a way to authenticate at one place (Identity Provider) and access multiple systems (Service Providers) without the need to re-authenticate. Your SSO implementation may allow to authenticate at ...


2

There are a couple of areas that you will have to understand and provide focus in testing. Understand the Purpose of the API that you are testing. What is it for? How is this going to be used? Answering these questions should provide you with test ideas related to your context. Here are Sample Test ideas based on my personal experience in testing: Input ...


2

I worked on a reasonably similar stack and I would be looking at starting at the ‘lowest’ layer possible and work my way up to testing A. So, in this case, I would be aiming to test B, C and D. Granted you’re doing some testing of another groups API, but if you’re not responsible for B, C and D, just devise tests to give you sufficient assurance that it ...


2

In a similar case, we went with writing our own very light weight framework. Reasons are: We were not using many of the features of Soap UI, so just to make Restful calls, Soap UI is an overkill The paid version was costly for our need; extending the free version needed Groovy skills - Groovy was not a language our team was familiar with Soap UI projects ...


2

It should normally be somewhere in the first response, either in response body, or headers, check the first response for anything looking like a token, extract it using a relevant JMeter PostProcessor, convert into a JMeter Variable and replace recorded hard-coded value with the variable coming from the PostProcessor. The process is known as correlation and ...


2

Yes, this should be very easy with Karate. I suggest you don't over-engineer tests and make 2 requests in your test. Save the response of the first request. Now all you need to do is perform a match of the first response - that it is equal to the second response. And because Karate allows you to set some fields of the "expected" JSON as #string or #notnull ...


2

Read books Attend meetups Organize meetups Browse this site daily Learn about HATEOS Post questions and answers here Read questions here on API's https://sqa.stackexchange.com/search?q=restful+api


2

Here are the steps: Prepare a request returning the data you need Create a Test Suite Create a Test Case within that Test Suite Add that request as the step to the Test Case Open that step editor In the bottom left corner click "Assertions" Click [+] (add) button In "Add Assertion" dialog select "Property Content" (right hand pane) In the list of shown ...


2

Let's start from the bottom line- unless you revolutionize everything there will be no magic solutions. Martin Fowler describes here the most common approach- test against a simplified copy of the external services, and occasionally verify that those copies behaves the same as the source. The problem with this approach, beyond the obvious of ...


2

you are trying to make an element called 'Item IsKit =\"false\"' it looks like you actually want to create an Element called Item with an attribute called IsKit. Try this: new XElement("Item",new XAttribute("IsKit", "False")) Docs are here https://docs.microsoft.com/en-us/dotnet/api/system.xml.linq.xattribute


2

I believe Alexey and MivaScott have provided good advice here. I would like to add some additional thoughts on why coding to use any possible REST API client may not be the best idea. Some of this will look blunt, but it is not a criticism of you. I think what you're trying to code is an overcompensation for mistakes that people have made when designing ...


2

Should an automated testing project be created complex as much as software being developed? Probably, I would handle test-code the same as production-code. It should be as complex as it needs to be. It should be just as maintainable and understandable. Upto what extent a software automation project use these services and modules etc techniques? When ...


2

Automation is about writing code. It therefore can (and should) be as complicated or simple as need for the purpose it is needed. Generally a more complex application, for instance one with many workflows, a mixture of JavaScript frameworks and long and detailed forms will generally require more effort and more programming approaches, such as the use of ...


2

Should software test automation projects echo the structure of the application in test? If "Echo" means to follow the same structure as the project from a code perspective (e.g. have package structure matching the application code) then no, not necessarily. If "Echo" means to model the application effectively - then yes, that can be very helpful. For ...


2

Another option you could try is Google Voice (voice.google.com). This will give you a web interface to a phone number which is free for your first number. I have used the app to test two factor authentication, so it should work for at least manual testing of your scenario. Google allows you to have one number without charge, but you need to pay for any ...


2

Your data is not a valid JSON, you can check it yourself using i.e. online JSON formatter and validator You syntax of combination of __eval() and __FileToString() functions is incorrect, you should wrap the __FileToString() function into the __eval() and you're doing the opposite thing: ${__eval(${__FileToString(${Json_request.txt},,)})} More information: ...


2

Your JSON is not valid: 1 { 2 "User ID": 204120, 3 "name": "New User", 4 "Description": [{ 5 "name": "john", 6 "id": 204110, 7 "type": "robotics" 8 }], 9 "Status": "Post request Successfully" 10 } You need to add a name to the value on lines 5,6,7 Or you need to remove the {} brackets to make it valid "Description": [ "john", ...


Only top voted, non community-wiki answers of a minimum length are eligible