12

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 ...


12

You should always pick tests carefully when it comes to test automation. :) One of the reasons, as you said, is overlap (and with that, execution time and robustness). An example to clarify: Your API has 10 endpoints which might return several different error messages each. Don't test each error as a UI test: this will take up lots of runtime and will also ...


8

HTTP is a synchronous protocol* so active polling is not an option. You need to wait until client receives response or request times out. There are two ways to constrain synchronous behaviour with timeout. One is to set a timeout for receiving a response. REST-Assured uses Apache HTTP Client for which you can set http.socket.timeout and http.connection....


6

There is no concept of overlapping testcases in different test levels, Both are completely isolated Just because API works fine you cannot guarantee UI works fine. Imagine all your API tests passing but user not able to use the UI , Imagine all your UI working due to cached information but actual backend is failing. Ensure more low level coverage like unit ...


5

GitHub is really useful for lists of resources and I came across one yesterday that is a collection of free APIs for use in web development. <- I think you'd be good to test most any of these APIs for practice as well. The List is fairly descriptive mentioning which APIs have auth or not and then you can click to the API's, read the documentation and ...


5

As @Mache says, you search for each value. var jsonData = pm.response.json(); pm.test("Verify Json values", function () { pm.expect(jsonData.data.id).is.to.equal(2); pm.expect(jsonData.data.first_name).is.to.equal("Janet"); pm.expect(jsonData.data.last_name).is.to.equal("Weaver"); // and so on and so on }); The better option: Create ...


5

The tests serve different purposes. Overlap is good. The 'overlap' of higher order tests (such as API) and Unit tests should be high. In fact 100% would be good. Unit tests mock and stub all dependencies. API tests do not. API tests may involve calling many units via the initial call. A unit test should test only one unit. Unit tests are involved in TDD ...


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

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

A few thoughts: Automation code should be reviewed, so I don't think that's a con Not sure why failing test cases would keep your build from compiling. Even if the test code lives in the same repo as the application code, your build scripts should ignore the test code when compiling deliverable code. There might be a failure further down your build chain ...


3

ReSharper is just an IDE for C# by JetBrains. This won't help you much unless you want to write everything from scratch. Postman has the ability to generate code snippets for various languages and frameworks, including C# (using RestSharp as REST/HTTP client). Consequently, you should be able to simply "convert" your requests to C#. (Haven't tried this ...


3

If you are looking to verify JSON response, there is a library called postman-bdd for Postman, which lets you write BDD styled test, using the chai-mocha syntax (but can also be used to write jasmine styled syntax). I have used this library for almost 2 months now and it's pretty handy. Taken directly from the library's npm page - Postman's built-in test ...


3

Let's take a step back and start by asking what are you trying to achieve. Rest API is an API like any other API, hiding behind it a lot or a little. I suppose that in our case there is a whole system behind the API, a system that you want to test. For me, this answers your last questions you need proper tests at different levels for you backend as well as ...


3

As with any project, it depends :). That said, (1) and (2) require close coordination with development team. Depending on the team structure it may be a good thing or a bad thing :). I also suspect in both cases some code will have same development (unit) tests as your tests. For example, a DTO might have a bug which may not be caught by both the teams. (3) ...


3

It depends Some things you may want to consider: Badly formed input - how does the API handle badly formed input? Can you send it something from the Big List of Naughty Strings and get back data you didn't expect? Security - If the API uses an auth header, can you access anything useful without one? If something else is used, can you bypass it with your ...


3

Just to add one more explanation. In REST API, the / indicates a hierarchical relationship between resources. This one rule is already broken when you send a POST req to /api/v1/product/2 and 2 means a category id. Category is not hierarchically under products. In this example, what category a product belongs to should go into the request body: { ...


3

TL;DR: you will have overlap between E2E and API integration test cases, in terms of the same endpoints being exercised in both and that's OK - it helps you figure out where the problem is if (...when) something goes wrong. When working with a codebase that doesn't currently have comprehensive automated testing, start with the E2E(/functional/UI) tests. Why? ...


3

That's a broad question. I recommend taking one or two resources and start exploring from there. You can find some ideas about API testing here and specifically if you ask about security, you can focus on OWASP API security In general, some ideas relating to security: authentication: what endpoints could be used only when authenticated? are there some that ...


3

https://www.postman.com/explore it have many collections and examples, you can create a account and fork it and use. or create your own mock server here and learn: https://app.mocklab.io/


2

Retrofit OkHttp curl command line tool


2

I don't think that best practices vary just because the underlying technology is rest-assured. We use cucumber to organize our tests. The cucumber steps are written in java. Some of our tests are UI oriented (browser) while others are API focused. For the latter we use a mixture of rest-assured (for web endpoints) and DAO (for accessing database and ...


2

Short answer is yes. It is really okay to use bdd tools to automate testing of a Rest API UI testing involves HTML, JavaScript and a DOM. The BDD should describe behavior. Given, When, Then statements that describe actions like click a button miss the point of BDD. What behavior are you trying to test? The application could change the actions that ...


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

Check out Test Fragments and Module Controller test elements. You can define your so called "Thread Groups" as Test Fragments and refer them via Module Controllers orchestrating the test flow and workload as per your requirements by using either iterations on Thread Group level or coming from Loop Controller. See JMeter: Using the Module Controller for ...


2

I would recommend switching to JSR223 Assertion and Groovy language as: Since JMeter 3.1 it is recommended to use JSR223 Test Elements and Groovy for scripting Groovy has built-in JSON support so you will be able to parse responses without using any extra test elements or libraries Groovy performs much better than Beanshell So if use the following Groovy ...


2

How can I using java and something like rest-assured test this API? can I some how mock it to test or do I need to write my automation code in c# in order to do this? The same way you would with a Java application except it wouldn't be during deploy. The underlying language of the application shouldn't make a difference. Should I deploy the API on to a ...


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

You can, however that would be quite a tricky thing, since you will have to take care of forming request body (envelopes) and parse the responses in order to make your requests comply with SOAP protocol. But initially RESTAssured is not intended to work with web-services. If you use Java I would recommend you to use one of the following ways to generate ...


2

You need to apply the below areas to your framework: The body for the POST call should be coming from a model file. Use a java serialization/de-serialization library like jackson or Gson to achieve this, although RestAssured has this feature. Creating complex json becomes easier. Create a RequestSpecBuilder to create the POST call, so that you can reuse ...


2

You can use the API playground for learning purpose. https://restful-booker.herokuapp.com/


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