Not getting the API testing sampler in jmeter 3.2 - jmeter

I am using jmeter version 3.2 for REST API testing but i am not getting the API test request sampler in this version. Anyone who is working on the same version please let me know the option. Currently i am test the API through HTTP request sampler.

What do you mean by API test request? You should be able to test either SOAP or REST API endpoints using HTTP Request sampler, you will just need to add HTTP Header Manager to send Content-Type header, in your case it will most likely be application/json
References:
Building a SOAP WebService Test Plan
REST API Testing - How to Do it Right

Related

Cucumber RestAssured Report with Request Response

I am trying to generate Cucumber reports for Rest-Assured (RESTful API) and I am also keen to capture request / response in the cucumber reports. I was wondering if anybody has already implemented this or can provide some pointers.
You can try Gherkin/BDD with QAF for web service testing and in the report it gives request and response for each request.

Can we use Jmeter with Rest Assurred framework?

I need to know if we can implement Jmeter script with the RestAssured framework?
Theoretically yes, given you copy RestAssured .jar file along with dependencies to JMeter Classpath you should be able to use its methods from JSR223 Test Elements or reuse your existing tests via JUnit Request Sampler
However it would be much better to use JMeter's HTTP Request samplers as in this case you will be able to access networking metrics such as Connect Time and Latency, automatic failures on HTTP Status Codes above 399, Cookies, Headers, and Authorization management, etc.
See REST API Testing - How to Do it Right article to learn how to build an API test plan using JMeter

Interceptor Headers not included in response

Using Retrofit 2.1.0 and OkHttp 3.4.1
Test project https://github.com/liamheneghan/okhttpAuthenticatorInterceptTest
Retrofit is setup using an OkHttpClient with an Authenticator and Network Interceptor which will attach a header. When I get a 401 and enter the authenticator
response.request().headers()
Contains no headers. However, I can see that the network request did include the header from the network interceptor. Is this the correct way to access the headers attached via the Network Interceptor?
Does this work?
response.networkResponse().request().headers()

Send Mock response for Soap Request

We have created an soap request and sending the request using WebServiceTemplate
WebServiceTemplate.marshalSendAndReceive(request)
As my client is not ready with the server. I am trying to handle this request in my local and planning to post some dummy response.
Can you help me how I can mock this response?
If you are using CXF, see my JUnit Rule utility project. It creates an Endpoint using JaxWsServerFactoryBean.

401 Authorization Required on REST client

I am trying to write a very simple REST client using RestTemplate and Jackson JSON.
Tried such sample from spring.io Getting error 401 Authorization Required even on localhost or even if I include it into the same Tomcat6 Eclipse project where that REST WebService is running.
We don't require any authorization on that Web Service while in Dev or local environment,
and anyway I am an authorized user.
Is that something enforced by Spring RestTemplate?
Running client as Java application on Java 1.6.
I am new to REST and JSON.
No there is no enforced Authorization required by Spring's RestTemplate. You should be able to build or launch an example simple REST webservice and send requests to it with RestTemplate without receiving this response, so either the server you are sending the requests to or something inbetween is returning this response code. Can you share any more details of the service you are communicating with? Is it something internal or a public API which may require Authorization?

Resources