Is there is any function like No response in CAPL - capl

I am new Canoe and capl programming i want to request can message and if no response then my test case should pass there is any cmd available in vteststudio.
please let me know.

You can simply use
testWaitForMessage
with the appropriate message and timeout.
The call will return -1 when the message was not received within the given time.
Then you can set the verdict using testStepPass or testStepFail.

Related

Non text response data received in Jmeter sampler response

When I running Jmeter in non gui mode Im getting response error in Jmeter
Im using below mentioned settings in the simple data writer in the script
I want to know whether server under test has thrown this Non-text response data error or error is something else and Jmeter is not able to interpret it so it is showing that.
Can someone help me understand this.
Thank you!!!
This error will occur when SampleResult.getDataType() function returns anything other than text
You can try writing the response data using JSR223 Listener and some custom Groovy code, for instance:
if (!prev.isSuccessful()) {
new File('response.bin').bytes = prev.getResponseData()
}
you can amend this response.bin filename to include the current thread number, iteration, name of the sampler and so on

Extracting response and using While Controller to wait for response in Jmeter

All, I need additional assistance. I have tried researching and was using this following resource guide. https://www.blazemeter.com/blog/using-while-controller-jmeter
Problem
I need to Implement a way to wait for a specific Response from the server and record the time it takes from the start of the request to the end where I get a response of Complete in Jmeter. I have been looking at while controller and researching it.
Problem#1
If I add a while controller, my request failed because its adding multiple token. If I leave it without the while controller then it only gets 1 bearer token and it is able to submit a get request and get the response appropriately. I am suspecting there is a pre-procession somewhere else in my script that doing this...
Uses beanshell preprocesser to grab the token
sampler.getHeaderManager().add(new Header("Authorization","Bearer " + vars.get("BEARER")));
Problem #2
I have a GET Request to check the status of the request. Response in the BODY comes back as this json
"{"Status": "RECEIVED", "DllUrl": "", "Message": " "}"
I need it to continue checking for the status of COMPLETE……..also may need to check for failed as well
Was looking at regular Expression extractor to get the status and only stop until it finds COMPLETE status. That way I can measure time start and end time for completion. Any help and guidance will be helpful.
You're adding a header and not removing the previous one therefore it adds another header on each iteration.
In fact you don't need to do any scripting for this, you can just define the header in the HTTP Header Manager:
With regards to extracting this Status value, it's better to do it using JSON Extractor configured like:
Once done you can use the following __jexl3() function to "wait" till the operation finishes:
${__jexl3("${status}" != "COMPLETE",)}

Is there anyway to hold response until we get full response from server in Jmeter?

The services I'm trying to test, will work on long pooling method.
They won't give results in first response.
When I run my API script I am not getting full response in first time.
How can I wait in this case for the remaining portion of response to be received?
I want to use values from this response into next call..
In the above screen my response should wait when complete:True
As far as I understand your requirement you need to repeat the Gethotels request until complete attribute becomes true.
In order to accomplish this:
Add a JSON Extractor as a child of the Gethotels request and set it up as follows:
Put your Gethotels request under the While Controller and use the following __jexl3() function as the condition:
${__jexl3("${complete}" != "true",)}
That's it, While Controller loop the Gethotels request until complete becomes true

Capl - simulation of TestWaitForDiagResponse (available for canoe only) through capl in canalyzer

I am using canalyzer. How to simulate the TestWaitForDiagResponse function of canoe in canalyzer using capl?
You can use TestWaitForDiagResponse() function only with the CANalyzer pro or with CANoe. Please note, Waiting for diagnostic events is only possible in test modules! Conventional CAPL nodes continue to operate, but only by the event-driven principle.
To call this function you have to create a test module. There are two types of TestWaitForDiagResponse function:
1. long TestWaitForDiagResponse (diagRequest request, dword timeout);
2. long TestWaitForDiagResponse (dword timeout);
For the first one you have to declare a diagnostic-object like DiagRequest ServiceQualifier request; This function waits exactly for the declared response object with the configured protocol (P2/P2*) timings.
The second function is waiting for any response with the configured protocol (P2/P2*) timings.

Jmeter Script-Error Message in Response Data but Successful result in sample Result

While running Jmeter scripts, one of the step is failing but Successful Result is coming in Sample Result as:
Sample Count: 1
Error Count: 1
Response code: 200
Response message: OK
But error message is coming in Response Data as:
Unfortunately, we could not delete your entire itinerary because of a database synchronization error.
If you could please re-load your itinerary and try again, we would appreciate it.
Thank you for your patience.
I need to re-submit the Request for that i am using the While loop comparing the Response Data then try to resubmit the request which is not working as.
if(ResponseData.equals("Unfortunately")==true)
{
log.error("Database synchronization error...Re sending Request");
vars.put("resubmitflag","true");
}
The problem i believe that i am not using correct functions for it as
ResponseData.equals will not work as how we can compare whole response data
which is not possible.
Kindly anyone help how to proceed and what functions need to use for that.
If you're talking about Beanshell Post Processor, there are a couple of issues with your code.
ResponseData isn't something, which is available to Beanshell Post Processor. You need either use data (which is byte array previous sampler response representation) or prev (which stands for SampleResult class for previous sampler).
equals method checks 2 strings for being identical. In your case you need to consider either startsWith or even contains method.
See following code samples for reference
String response = new String(data);
if (response.contains("Unfortunately")){
log.error("Database synchronization error...Re sending Request");
vars.put("resubmitflag","true");
}
or
String response = prev.getResponseDataAsString();
.....
See How to use BeanShell guide for more details.
Hope this helps

Resources