Is jmeter insert the data in real time? - insert

Currently i am using j meter.I have a test plan order like
Login,Add Patient(After login).After executing the test plan successfully,i checked the application whether new patient is added or not.Yes,Its added in the application when the test plan(HTTP) is successful.Now i have two questions
Data is added in the application,Whether its correct or not?
Suppose i don't want to insert the data in the application means what
i have to do.Is there any configuration?.

You can use i.e. Response Assertion to automatically check whether patient was added or not.
If you considering a form of negative testing i.e.
ensure that patient will NOT be added if wrong credentials are provided
ensure that patient will NOT be added if logged in user doesn't have permission to add patients
You can use the same Response Assertion but with reverse condition.
See How to Use JMeter Assertions in Three Easy Steps article for more information on how to conditionally set pass and/or fail criteria basing on request results.

Related

JMETER Performance Testing - Dynamic Payload

While doing performance testing via JMETER, I encountered one usecase where the POST request call is taking the dynamic data from the website. So in that case when we run our script it fails as that data is no more available on the website.
Payload looks like given below. It is a POST CALL and the payload is changing everytime.
{"marketId":"U-16662943","price":{"up":98,"down":100,"dec":"1.98"},"side":"HOME","line":0,"selectionids":["W2-1"]}
Could anyone suggest how we can make this payload dynamic when we create a script in JMETER?
I can think of 3 possible options:
Duplicate data is not allowed. If this is the case you can use JMeter Functions like __Random(), __RandomString(), __counter() and so on
The data you're sending needs to be aligned with the data in the application somehow, in this case you can use JDBC PreProcessor in order to build a proper request body basing on the data from the application under test database
The data is present in previous response. In that case it's a matter of simple correlation, the dynamic values should be extracted from the previous response using suitable Post-Processors and variables needs to be sent instead of hard-coded parameters

Authorisation testing by generate key in Jmeter - idea of test case

I'm testing authorisation in JMeter. Authorisation is by key, which is sent in JSON.stringify. First is open connected by web socket, next sent is key in JSON format.
Key is generated in the tool.
What test case could be?
I think set happy path, and next authentication failed and in this give
missing key - what testing/set this in JMeter?
bad key - not exist
If is test case, that key not exist, it's worth additionaly create test case, that key is too long or too short, or wrongly sign?
What could be test case for this authorization?
Test case on input and output, e. g. no connection to the web socket connection? Are correctly?
I'm also thinking about test case, that JSON are wrong format or empty JSON lack JSON? It is correctly?
What could be addicted test case? What testing authentication in JMeter?
Your test case will have only 2 types of expected result:
You're logged in (in case of "good" key)
You're not logged in (in case of "bad" key) - so called Negative Testing
My expectation is that you should be at least checking that the system doesn't let you in when you provide the wrong key, to wit "happy" and "unhappy" responses must be different.
Going forward you can check if unauthorised user doesn't have access to the parts of the application he should not be having access to.
Also if your application assumes role-based access control you should also check whether effective permissions of the user match his role (i.e. read-only users should not be able to create/update/delete stuff)
In the absolute majority of cases you can use Response Assertion to check presence/absence of a text/pattern in the response

VS Load Test Scenario - How can we add custom scenario info to database

I have a Load Test project that works perfectly and is able to saves all the perf counter in the LoadTest db as expected.
I wanted to add some specific scenario attributes information to my test run.
Therefore when I create a report in Excel at the end, ill be able to filter based on those attributes
Example:
Environment Attribute: (QA, PreProd, Production)
Target Attribute: (UI, API,..)
I searched everywhere but couldn't find the information. Not sure if I have to create a new table in that DB and populate it myself, or if there is another easier way.
The closest I have achieved to doing what you ask is by modifying the "reporting names" of requests to include the wanted information. On one test I added a test case that executed a small number of times (so few that the overall results would not be skewed). It had two requests. The first collected some data and saved it to a context parameter. The second had a PreRequest plugin that wrote the data to the ReportingName field of that request. (Experiments showed that setting the field in a PostRequest plugin had no effect.)
Another approach I have used is have a PostWebTest plugin that writes a line of useful data to a logging file, so I get one line per test case executed.
It may be possible to add another table to the load test database, but I would wonder whether it would be properly handled by the Open, Import, Export and Delete commands of the Open and Manage Test Results window.

How to create Test plan for dependent REST API's?

I have 3 Rest API's, each one of them dependent on each other, how to create test plan for them, jmeter firing those urls non sequential order i want it in Sequential order, when i check on "view result tree" i am getting 403 error.
Are they in the same thread group? If so, they ought to fire sequentially in order.
If the three are dependent on each other you need to take following steps:
Add thread group
Put the API's one after the other based on the values and dependency.
Extract the value from the first API and pass it to the next using Post Processors like Regular Expression Extractor or JSON extractor.
You are seeing 403 which is related to forbidden access, it means that you are not allowed to access that particular URL or missing some authentication token or cookies or username/password.
So add the authorization manager to your test plan if that's missing and send appropriate values.

why Loadrunner Correlation is getting failed

I want to correlate this 181-418-5889 in the following statement: regSend&transferNumber=181-418-5889".
I used the regular web_reg_save_param: But it failed... any suggestion?
You are using the statement in the wrong location, such as using it just before the request is sent containing the correlated value versus just before the location where the response containing the value is sent to the client
You are not receiving the correct page response and as a result you may not be able to collect the value. The page may be an HTTP 200 page but the content could be completely off. Always check for an appropriate expected result
Your left boundary, right boundary and other parameters are incorrect to collect the value you need
You have not been through training and you are being forced by your management to learn this tool via trial and error
1- I am not using the statement in the wrong location since I did find the needed value I want to correlate via the Tree function and put it just before the statement that hold this value
2- The Page is not an HTTP 200
3- The Left and right boundary are correct since I checked the text if it does exist twice in the response body.
4- I know the tool (Loadrunner) but in fact, the application is developed under ZK platform and I am not sure if ZK and Loadrunner are compatible knowing that I did implement the dtid function in my script to have a static desktop id each time I replay the process.

Resources