Disable requests in postman collection run - postman

I have 100 request in collection runner and there are some request that will execute only on some condition. Actually when we run the postman collection it will execute all request 1 by 1.
In my case there are 10 requests in collection runner and dont want to execute it in normal follow only trigger some request just on specific condition. Is there any why I can prevent these request not no execute in normal run but should available in collection runner will execute on just specific condition

In my opinion you can achieve this already.
I will user some flag set in environment variables to check if it is your "normal" run or not
And next use this flag in test script to set next request to be called:
if (pm.environment.get("normal_run"))
postman.setNextRequest("Request name 10");
else
postman.setNextRequest("Request name 13");
And set this part of code in every request before request you need to be skipped.
postman.setNextRequest() is executed in the end of request call, so you can place it anywhere in Pre-request Script.
Finally, use one environment for your normal run, and second environment for another.

Related

Setting timeout for postman collections

I want to run the Postman collection with timeout enabled at the collection level.
Is this setting possible at the collection level in Postman?
I know that the timeout can be set per request using setTimeout(() => {}, 15000), but I could not find something similar to run the collections.
Request timeout for single call
Postman has a setting that you set manually in Settings > General > Request timeout in ms that you can set if you want to set an explicit timeout. However, you won’t be able to do what you’re trying to do from a script.
You can, however, write request tests to make sure your response times
are under a certain threshold. That way when you run the request, the
test will fail if it’s slower than say, 800ms:
pm.test("Response time is less than 800ms", function () {
pm.expect(pm.response.responseTime).to.be.below(800);
});
According to https://community.postman.com/t/request-timeout-for-single-call/6881/2

In a Postman collection, one of the services only needs to be called once

I'm designing a fairly simple collection, with two services in the collection:
Request # 1 : get token service
Request #2 : service to get detailed information (needs token from previous service)
I've managed to get the token from service #1 and set it into a variable, and use said token in Request #2. I then use a csv file in Runner to call service #2 using different arguments.
What I'm trying to achieve is to run service #1 only once, instead of running as many times as the number of lines on the CSV. Is it possible?
You can use postman.setNextRequest("request #2"); in the Tests script of request #2 to skip the execution of request #1 after the first run.
But you also need to add a condition to only do that while pm.info.iteration is smaller than your amount of required executions to avoid an endless loop.

Jmeter- Load testing EC2 instance, only 50% request are successful

I am trying to load test Nginx installed on an EC2 instance via Jmeter, Everytime I try to load test, only 50% request are successful,
For Eg:
If I try with 10 users, only 5 response are OK
If I try with 100 users, only 50 response are OK
If I try with 500, only 250 response are OK
Any Idea, regarding this strange behavior?
This sounds weird. I would recommend the following troubleshooting techniques:
First of all always check jmeter.log file, it should contain enough information to get to the bottom of your test failure(s).
If JMeter log file doesn't contain any suspicious entries next step would be checking response messages using i.e. View Results In Table and/or View Results Tree listener. This should provide you some high-level information and trends, i.e. you will be able to see if some particular sampler(s) is(are) always failing.
If above steps don't give enough clue to resolve your issue you can temporary enable saving of request and response data to see what is wrong with the failing sampler(s). Add the next lines to user.properties file (located in JMeter's "bin" folder)
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.responseHeaders=true
jmeter.save.saveservice.url=true
and next time your run JMeter test the .jtl results file will contain all the relevant data which can be analyzed using aforementioned View Results Tree listener. Don't forget to revert the change once you fix the script as JMeter listeners are very resource intensive per se and above settings greatly increase disk IO and it may ruin your test.
If none of above helps - check logs on the application under test side, most probably you will get something from them.

Is it possible to make a schedule that Postman executes request?

I am using Postman to run a Runner on some specific requests. Is it possible to create a schedule to execute (meaning every day on specific hour)?
You can set up a Postman Monitor on your collection, and schedule it to execute the request each minute/hour/weekly basis.
This article can get you started on creating your monitor. Postman allows 1000 monitoring requests for free per month.
PS: Postman gives you details about the responses as in No. of successful requests, response codes, response size etc. I wanted the actual response for my test. So I just printed the response body as shown below. Hope it helps someone out there :)
Well, if there is no other possibility, you can actually try doing this:
- launch postman runner
- configure the highest possible number of iterations
- configure the delay (in milliseconds) to fit your scheduling requirement
It is absolutely awful, but if the delay variable can be set high enough, it might work.
It implies that postman is continuousely running.
You may do this using a scheduling tool that can launch command lines and use Newman ...
I don't think Postman can do it on its own
Alexandre
EDIT:
You may do this using a scheduling tool that can launch command lines and use Newman ... I don't think Postman can do it on its own
check this postman feature : https://www.getpostman.com/docs/postman/monitors/intro_monitors
from postman v10.2.1 onwards you can schedule your collections to run directly (without using monitors) on the specified times
check out here - https://learning.postman.com/docs/running-collections/scheduling-collection-runs/

How can I force ColdFusion to stop rendering a page until a process invoked with <cfexecute> completes?

I'm working on a script that creates a MySQL dump via <cfexecute> and then FTPs the SQL script to another server. I've resorted to checking once per second to see if the filesize has changed, and if it has not changed within the past five seconds I assume it has completed.
This is fine for the current application, but eventually I would like to be able to import the SQL script on the second server and provide some sort of notification that it has completed.
Is there some way to track the status of a running process?
If not, is there a way to accomplish a full DB export and import via ColdFusion alone?
Actually you may not realize it, but when you call <cfexecute> without passing a timeout attribute it defaults to '0' timeout. And if you read the docs on <cfexecute> you'd see:
If the value is 0:
ColdFusion starts a process and returns immediately. ColdFusion may
return control to the calling page
before any program output displays. To
ensure that program output displays,
set the value to 2 or higher.
So I would suggest passing a higher value for timeout which will cause ColdFusion to wait for mysqldump to complete before moving on.
Reference
Check out Event Gateways[1] for one way to deal with asynchronous operations. There's a Directory Watcher gateway that comes with CF as an example.[2]
Barring that, create some sort of batch processing facility using CF Scheduled Tasks. Add the job to a database table and have a scheduled task periodically pull jobs out of the table and execute them, reporting on the result. A second scheduled task can detect that the first completed and carry out the next step of the process.
[1] http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec214e3-7fa7.html
[2] http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-77f7.html