Is it possible for a Java request to have a summary report to it. I tried attaching
TPS listener, results tree, results table but could not see the report populated after running in jmeter.
It is not explicitly mentioned jmeter docs, but i assume, It should be supported.But i am not able to see it even after successful run of the test as seen from logs (runTest() method gets called successfully)
It is
The runTest() function is supposed to return a SampleResult and it's your job to call the necessary functions like:
create a new instance
call sampleStart() function when you want to start the measurement
call sampleEnd() function when you want to stop the measurement
call setSuccessful() function to mark the sampler as passed or failed
call setResponsecode() and setResponseData() functions to set response code/response body if needed
See JavaTest and SleepTest example implementations for reference.
You may also find JSR223 Sampler with Groovy easier to use (Java syntax should work in the majority of cases)
Related
in the first thread, I received JSON (format - {"id":6054,"name":"Jmeter created chat","description":"jmeter created test"})
I want to use it in the second thread variable '6054'
I use BeanShell Assertion with code:
${__setProperty(("id":"(.+?)"), ${chat_id)};
but it, of course, doesn't work, please tell me the right way..
many thanks
It won't work because your __setProperty() function call doesn't make sense at all and it's syntactically incorrect
Since JMeter 3.1 you're supposed to use JSR223 Test Elements and Groovy language for scripting
So
Remove your Beanshell Assertion
Add JSR223 PostProcessor as a child of the request which returns the above response
Put the following code into "Script" area:
props.put('chat_id', new groovy.json.JsonSlurper().parse(prev.getResponseData()).id as String)
In 2nd Thread Group access the value using __P() function as:
${__P(chat_id,)}
Demo:
More information regarding what these prev and props guys mean can be found in the Top 8 JMeter Java Classes You Should Be Using with Groovy article
P.S. You may find Inter-Thread Communication Plugin easier to use
I want to run MapReduceIndexerTool from Java.
Right now I do it from command line using hadoop jar as you can see here, but I want to check it's status (to see if it's finalized, in progress, etc.) from Java code.
So basically I want to run it from Java in order to be able to check it's status from Java. Is there a way to run it from command line and check it's status from Java?
Also, there is a way to make Map Reduce to send an event (on a callback for example) when a job is completed? Something like a webhook?
As far as I know Tool interface exposes only int run(String[] args) method, so in general you would create new instance, form proper argument string and call that method.
From other hand, MapReduceIndexerTool has int run(Options options) method, that could be used to run it without forming shell-style argument. However, this method is protected, so this will need to have calling class to be created in same package as MapReduceIndexerTool.
I'm attempting to retrieve lambda function specific logs after invoking a lambda function. Is there an appropriate aws java sdk method to retrieve the logs of the lambda execution after invoking the function?
The AWS Lambda - Logging (Java) documentation makes three recommendations:
Find logs in CloudWatch Logs. The context object (in the aws-lambda-java-core library) provides the getLogStreamName() and the getLogGroupName() methods. Using these methods, you can find the specific log stream where logs are written.
This case most matches your question. Get the CloudWatch Log Group and Log Stream from your context object, and then pass them into the SDK's AWSLogsClient getLogEvents() method to retrieve your logs.
If you invoke a Lambda function via the console, the invocation type is always RequestResponse (that is, synchronous execution) and the console displays the logs that the Lambda function writes using the LambdaLogger object. AWS Lambda also returns logs from System.out and System.err methods.
This case is useful for manual testing/debugging from the console.
If you invoke a Lambda function programmatically, you can add the LogType parameter to retrieve the last 4 KB of log data that is written to CloudWatch Logs. For more information, see Invoke. AWS Lambda returns this log information in the x-amz-log-results header in the response. If you use the AWS Command Line Interface to invoke the function, you can specify the --log-type parameter with value Tail.
This case may be especially useful to you in a dev environment, and more readily available since you simply need to setLogType on the Java SDK InvokeRequest. Then, on the response, just check getLogResult.
Depending on your usage, think carefully before using this case in production. For example, will this leak your logs to your client? Even if it doesn't, is your volume sufficient enough to make this impractical?
I just want to know if there is any API or any thing which tells me all the method name which have been executed during one execution of application.
For ex. Lets say I have application with 10000 methods and based on some condition different methods get executed. So during one execution lets say if 100 method getting executed then I would like to know name of all these 100 methods in order of their execution.
is it possible?
There are few options you can use to track your method calls.
1. JProfiler http://www.ej-technologies.com/products/jprofiler/overview.html
2. Your kit. http://www.yourkit.com/
3. In addition you can write an application that logs to file when enters to methods and exit using Aspects with Log4j or SL4j
I wrote a custom Java Request which extends the AbstractJavaSamplerClient to measure the performance of a JAVA API invocation. However, now i need to measure the performance for a multiple API which is part of the same use case.
i.e.
Server severInst = new Server();
severInst.api1();
severInst.api2();
severInst.api3();
Need to get the metrics in Jmeter for each API invocation (api1, api2, api3). However, I cannot split those API calls since the api2 call is dependent on api1. (same for api3 which depends on api2). If i could split then I can write a different "Java Sampler Client" for each API. Since all these apis are inter-dependent i have to invoke all of them at once.
The method runTest returns only one SampleResult. However, I am in need of a situation where I need to return the multiple SampleResult. I tried the SampleResult.setParent() and SampleResult.storeSubResult() but no luck.
Any pointer on this will be helpful?
Thanks
How about creating three different tests. Each one collects the time for the required apis. So, in test 1 you'd have:
startTiming();
api1();
api2();
api3();
completeSample();
Then in the second test:
api1();
startTiming();
api2();
api3();
completeSample();
and so on.