How to Test performance of Graphql API - rest

I want to test the performance of graphics API, but Jmeter shows me the error of 400(Bad request) every time.
what I am doing is this:-
1.Created an Http Header Manager and provided respective content type and tokens
2.Created an HTTP Request
In Body:- Provided Graphql query(formatted query which postman accept)
3.Added a Listener
Every time it is showing Bad request but the same process works fine with Postman.
Please help.

If your requests works fine in Postman you can just record it with JMeter
Prepare JMeter for recording. The easiest way is using JMeter Templates feature.
From JMeter's main menu choose `File -> Templates -> Recording" and click "Create"
Click HTTP(S) Test Script Recorder and press "Start"
Prepare Postman for recording. Configure it to use JMeter as a Global Proxy
Execute your test in Postman
JMeter will capture the request and store it under Thread Group -> Recording Controller

Related

How can I use REST API authentication in Mendix?

I have designed an API REST service (with Bonita) to which I can perfectly connect with Postman, with the following parameters:
By the way, the x-www-form-urlencoded option that is selected comes from the Content-type application/x-www-form-urlencoded header that is not displayed in my screenshot. The official Bonita specification states that this header is needed and I always get a 200-OK status code as an answer.
How can I specify an equivalent request with the body part in a Mendix Call REST service in a microflow? Here is what I have so far:
I guess the body part should be specified in the Request tab, but I just don't know how to do it properly. I always get the following error message for my connector, which means that, whatever I specify, the username is not taken into account:
An error has occurred while handling the request. [User 'Anonymous_69a378ed-bb56-4183-ae71-c9ead783db1f' with session id '5fefb6ad-XXXX-XXXX-XXXX-XXXXXXXXb34f' and roles 'Administrator']
I finally found that the proxy setting was the actual problem. It was set at the project scope and simply clicking on No proxy in the General tab did the trick! (both services are hosted on my local machine so far)
I just had to fill in the dedicated Authentication field in the HTTP Headers tab then, with the correct credentials, to eventually log in my Bonita service.

How to convert soap message in Oracle OSB

I'm just starting with Oracle Service Bus 12C.
I created a proxy service that takes in a couple of parameters. A pipeline that moves those parameters to the request-headers. A business service that calls my PHP. So far, the PHP receives the parameters correctly.
Next, I am returning a response from PHP. As a first step, I did a simple echo "Hello, World";
Two things are happening at this point.
Firstly, when debugging the app, JDeveloper shows that $body in Response Action is blank. However, in a log action, I added $body. That shows:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">Hello, World</soapenv:Body>
No idea why JDeveloper doesn't want to show this.
So, how do I get the string part from this so I can use a Insert Action to build the XML response that the proxy service would understand?
I tried these in the log action, but all of them give blank outputs:
$body/*
$body/soap-env:body
$body/soap-env:Body
$body/soap-env:Body/#value
$body/soap-env:body/#value
Edit: According to https://docs.oracle.com/cd/E13171_01/alsb/docs25/consolehelp/context.html $body/* should extract the payload without the soap-env:Body wrapper.
Got it:
$body/text()
I noticed that the tag is soap-env in the request and soapenv in the response. The $body/* works for the request to remove the wrapper in the request only.

How to capture redirect response header

I am trying to record a simple login and logout flow for a .Net application. After I submit the login credentials the welcome page's URL has a large alpha numeric number. This number is required to continue to the next steps.
On Fiddler I have noticed that the login credential submission request results in a 302 response and this response contain an a=129characterstring that i need in my subsequent requests.
On JMeter I have added a recording controller and on the HTTP(S) Test Script Recorder I have Follow Redirects and Use KeepAlive checked (See below screenshot)
I have also recorded with Follow Redirects unchecked and different options for Grouping and HTTP Sampler Settings.
But with none of them I am able to record/capture the 302 response that i see on fiddler. Instead the login credential submission request always returns a 200 response, even if the login fails.
It is not as if that JMeter is not recording redirect requests, further down the scenario flow I have another redirect request which is captured.
I can't be the only one who is/has faced this problem. Does anyone have any suggestions on what I should be doing differently to get the 302 response?
To do this:
Record with default options, the redirect Http Request triggered by 302 will be disabled by default.
Then you will need after this to uncheck "Follow Redirect" in the first one, and add a Regular Expression Post Processor to extract the data you want.
Then enable the commented second request and inject the extracted variable.

Is it normal for IBM Connections opensocial gadgets to make 2 HTTP requests on gadgets.io.makeRequest?

Within an IBM Connections sharebox/share dialog gadget my-sharebox.xml, I make the following request:
gadgets.io.makeRequest(url, function (response) { ... });
Using tcpflow on the IBM Connections server to capture the outgoing request & response, I see 2 HTTP requests.
The first one to the url specified above, and a second request to the gadget XML file, my-sharebox.xml.
Is this second request expected behaviour?
Is it possible to somehow suppress the second request?
In a production environment it should be caching the gadget XML and only fetch it once. That will usually happen when the gadget is rendered. Do you have all debug parameters related to opensocial disabled?

Grails - integration tests for verifying REST calls

We'd like to add some integration tests for the many REST services that our Grails app exposes, instead of manually verifying them using the Firefox Poster plugin that we are currently using.
BTW, In our case it HAS to be an integration test, not a unit test.
I trust others have gone thru' this before and could save us some time instead of experimenting...
`grails test-app -integration`
Does the above command actually launch the functionality required to do a self-post to our own app (http://localhost/myapp) ? It would have to go through the url mapping pipeline, xml content negotiation, spring/acegi security, etc. If so, I suppose we could use the Groovy RESTClient as documented here:
http://groovy.codehaus.org/modules/http-builder/doc/rest.html
Google tells me another option is the functional-testing plugin:
http://thediscoblog.com/2009/06/15/grails-hip-tip-testing-restful-services/
Any comments or issues from the experienced? It's a Grails 1.2.1 app using plugins.acegi=0.5.2
What you want is
grails test-app integration:
As per http://grails.org/doc/latest/ref/Command%20Line/test-app.html
The REST services are usually created via actions in a controller that are set in the URLMappings to work with the different HTTP methods (GET, PUT, POST, DELETE), so since they are simple actions in a controller an integration test can be just a test method that test the action like any other, sending them the content-type you need, JSON for example and passing the correct data as JSON if that is what your services is expecting.
You can create multiple test methods for the same action to test the difference responses, for example if a non valid resource is requested than test that the service is returning the correct error code 404 for instance.