How to create a composed test fragment - rest

Let's suppose that to make a REST request C, I need to make a request A and a request B as a set up for the business case.
I know how to run 3 requests sequentially in jmeter, but I want just to C be measured by jmeter stats to see tps and response time. Is there a way to do that?
Let's say that A and B not necessarily will be executed in a near time in a real case, but they need to be requested before C.

There are 2 options:
Add JSR223 PostProcessors as children of requests A and B and use the following code:
prev.setIgnore()
this line will invoke SampleResult.setIgnore() function suppressing the output of the sampler(s) in the JSR223 PostProcessor's scope. Check out Top 8 JMeter Java Classes You Should Be Using with Groovy article for more information on JMeter API shortcuts available for JSR223 Test Elements.
Another option is using Filter Results Tool which allows removing "not interesting" entries from the .jtl results file. Filter Results Tool can be installed using JMeter Plugins Manager (you will need Merge Results as well), example command line would be something like:
FilterResults.bat --output-file onlyrequestc.jtl --input-file result.jtl --include-labels "Request C"

Related

Receive Prompts from a report using REST services for Pentaho

I was wondering if it is possible to receive the prompts used (with possibly all it's options) in a report using REST services.
What I like to achieve is receiving the prompts and if possible all the options for those prompts in an XML format from any given Pentaho report. I know there are rest calls for basic repository listings etc... but I can't seem to find this specific call.
It is possible to get full parameters xml (which includes parameters, parameters values, parameters attributes as far as info which is used to create report prompts) - full parameter info. You need bi server and reporting plugin. The url is:
http://localhost:8080/pentaho/api/repos/"%"3Apublic"%"3ASteel"%"20Wheels"%"3AInventory"%"20List"%"20(report).prpt/parameter
And we have to pass parameter renderMode with value: PARAMETER.
Here we call to report under /public/Steel Wheels/Inventory List (reprot).prpt
or simplifying -
"http://localhost:8080/pentaho/api/repos/<path_to_report>.prpt/parameter"
You can open browser and inspect requests responses just on fly:
On a screen is actually parameter requests you are looking for.

Outlook rest api "synchronize messages" ignores $expand in subsequent calls

I am trying to synchronize an Outlook folder (say the Inbox) using the beta version of the Outlook Rest Api see doc here
I need only to retrieve the property IsRead and the PR_INTERNET_MESSAGE_ID
So following documentation, for the first synchronization my requests look like:
The following Http headers are always added:
request.Headers.Add("Prefer", "odata.track-changes");
request.Headers.Add("Prefer", "odata.maxpagesize=5"); //Use a small page size easier for debugging
The first initial full synchronization request
https://outlook.office365.com/api/beta/Me/MailFolders('inbox')/messages?$select=IsRead&$expand=SingleValueExtendedProperties($filter=(PropertyId eq 'String 0x1035'))
Good results the value array contain what I need.
The second request after the first request uses the deltatoken
https://outlook.office365.com/api/beta/Me/MailFolders('inbox')/messages?$select=IsRead,Subject&$expand=SingleValueExtendedProperties($filter=(PropertyId eq 'String 0x1035'))&$deltatoken=a758b90491954a61ad463ef3a0e690a2
Bad results, no SingleValueExtendedProperties entries
Next requests for paginations with skiptoken...
https://outlook.office365.com/api/beta/Me/MailFolders('inbox')/messages?$select=IsRead,Subject&$expand=SingleValueExtendedProperties($filter=(PropertyId eq 'String 0x1035'))&$skiptoken=e99ad10324464488b6b219ca5ed6be1c
Bad results again, same as 2.
It looks like a bug to me. Can you provide a workaround? From a list of ItemId is possible to retrieve easily the list of corresponding PR_InternetMessage_Id efficiently (not item per item)?
Note also that in the documentation it is written that:
The response will include a Preference-Applied: odata.track-changes
header. If you attempt to sync a resource that is not supported, this
header will not be returned in the response. Check for this header
before processing the response to avoid errors.
It seems that for 2. and 3. calls this response header "Preference-Applied" is not set.
The sync functionality today doesn't support extended properties. However, we are working to enable this and it should start working in a few weeks.
EDIT:
For a workaround for the very special case of the PR_INTERNETMESSAGE_ID look at the comment below.

Using variables in SOAP request file in JMeter

In a JMeter (v2.13) test plan I have a SOAP/XML-RPC sampler. The SOAP request itself is loaded from a random file.
Sample request
<mySoapRequest>
<value>555</value>
</mySoapRequest>
This works fine.
I would now like to replace this fixed value with a variable which is defined in JMeter, i.e.
<mySoapRequest>
<value>${someValue}</value>
</mySoapRequest>
It seems as if JMeter does not resolve this variable. The actual SOAP request sent to the service does not contain 555 but ${someValue}. Is there any workaround so that I could use variables in the file?
That can be done using FileToString and eval functions.
For this XML,
<mySoapRequest>
<value>${someValue}</value>
</mySoapRequest>
In the SOAP/XML RPC request Data section, use the functions as shown below to get the value replaced at run time.
${__eval(${__FileToString(C:\users\me\desktop\soap.xml)})}
__FileToString - The FileToString function can be used to read an entire file. Each time it is called it reads the entire file.
__eval - The eval function returns the result of evaluating a string expression.

Turn off access logger in go-json-rest

I am trying to write REST services in Go. As there are different frameworks for writing REST service in Go, we would like to do some performance testing before choosing the framework.
Currently I did a sample using go-json-rest.
But when I execute this sample REST request, I see the following logs printed in my terminal.
24/Nov/2015:12:30:35 +0530 200 29μs "GET /countries HTTP/1.1" - "Java/1.8.0_45"
This logging will take some time and impact my performance report.
How can I switch of this logging?
You should know that it's AccessLogApacheMiddleware that controls your logging, and DefaultDevStack contains the AccessLogApacheMiddleware.
Two ways to prevent logging:
You can use a predefined variable like DefaultCommonStack which doesn't contain the AccessLogApacheMiddleware;
Construct your own ...Middlewares. Since the Use function is a Variadic Functions, which pass the multiple middlewares into the function. If you don't need AccessLogApacheMiddleware, you just ignore it. It gives you more power to control whatever middlewares you like.
e.g.
api := rest.NewApi()
api.Use(&rest.TimerMiddleware{},
&rest.RecorderMiddleware{},
&rest.PoweredByMiddleware{},
&rest.RecoverMiddleware{})
May this be helpful.

Get result of REST sampler in JMeter

Please show me how can get the result of REST sampler in Jmeter. Because I need to to it for checking my sampler is right or wrong
Thanks,
You can use View results tree and uncheck Errors and Success check boxes in order to show all responses you receive. The Response data tab will show response data :) which you can format using drop down list in the lower left part of the View Results Tree component, bellow the request tree.
When you run test with large number of requests I suggest you check Errors (to record only requests that failed) to avoid filling up the RAM.
Or even better (for advanced test verification), you can use Assertions to mark the requests/responses that failed (which doesn't have to mean only "response code != 200", you may want to include your business logic and check arbitrary response header/param).
Add a 'View Results Tree View' to your testplan to see how the tests run.
When clicking on a test you can view the request/response data.
Next you might want to validate that response; add a 'Response Assertion' to your test
where you can match the response to anything you want.